Encrypt password.

This commit is contained in:
takezoe
2013-06-29 15:13:20 +09:00
parent cd2486344f
commit 10f2cbbc3e
5 changed files with 39 additions and 23 deletions

View File

@@ -2,6 +2,7 @@ package app
import service._
import util.OwnerOnlyAuthenticator
import util.StringUtil._
import jp.sf.amateras.scalatra.forms._
class AccountController extends AccountControllerBase
@@ -46,7 +47,7 @@ trait AccountControllerBase extends ControllerBase {
val userName = params("userName")
getAccountByUserName(userName).map { account =>
updateAccount(account.copy(
password = form.password.getOrElse(account.password),
password = form.password.map(encrypt).getOrElse(account.password),
mailAddress = form.mailAddress,
url = form.url))
redirect("/%s".format(userName))
@@ -61,7 +62,7 @@ trait AccountControllerBase extends ControllerBase {
post("/register", newForm){ newForm =>
if(loadSystemSettings().allowAccountRegistration){
createAccount(newForm.userName, newForm.password, newForm.mailAddress, false, newForm.url)
createAccount(newForm.userName, encrypt(newForm.password), newForm.mailAddress, false, newForm.url)
redirect("/signin")
} else NotFound
}