Add AccountService#updateLastLoginDate().

This commit is contained in:
takezoe
2013-06-04 14:04:03 +09:00
parent 315da9caa5
commit 5793851b7d
2 changed files with 9 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ trait SignInControllerBase extends ControllerBase { self: AccountService =>
redirect("/signin") redirect("/signin")
} else { } else {
session.setAttribute("LOGIN_ACCOUNT", account.get) session.setAttribute("LOGIN_ACCOUNT", account.get)
updateLastLoginDate(account.get.userName)
redirect("/%s".format(account.get.userName)) redirect("/%s".format(account.get.userName))
} }
} }

View File

@@ -28,6 +28,14 @@ trait AccountService {
account.lastLoginDate) account.lastLoginDate)
} }
def updateLastLoginDate(userName: String): Unit = {
val q = for {
a <- Accounts if a.userName is userName.bind
} yield a.lastLoginDate
q.update(new java.sql.Date(System.currentTimeMillis))
}
} }
object AccountService { object AccountService {