mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 14:05:52 +01:00
Fix updating in AccountService.
This commit is contained in:
@@ -13,12 +13,11 @@ trait AccountService {
|
|||||||
|
|
||||||
def createAccount(account: Account): Unit = Accounts.* insert account
|
def createAccount(account: Account): Unit = Accounts.* insert account
|
||||||
|
|
||||||
def updateAccount(account: Account): Unit = {
|
def updateAccount(account: Account): Unit =
|
||||||
val q = for {
|
Query(Accounts)
|
||||||
a <- Accounts if a.userName is account.userName.bind
|
.filter { a => a.userName is account.userName.bind }
|
||||||
} yield a.password ~ a.mailAddress ~ a.userType ~ a.url.? ~ a.registeredDate ~ a.updatedDate ~ a.lastLoginDate.?
|
.map { a => a.password ~ a.mailAddress ~ a.userType ~ a.url.? ~ a.registeredDate ~ a.updatedDate ~ a.lastLoginDate.? }
|
||||||
|
.update (
|
||||||
q.update(
|
|
||||||
account.password,
|
account.password,
|
||||||
account.mailAddress,
|
account.mailAddress,
|
||||||
account.userType,
|
account.userType,
|
||||||
@@ -26,15 +25,10 @@ trait AccountService {
|
|||||||
account.registeredDate,
|
account.registeredDate,
|
||||||
account.updatedDate,
|
account.updatedDate,
|
||||||
account.lastLoginDate)
|
account.lastLoginDate)
|
||||||
}
|
|
||||||
|
|
||||||
def updateLastLoginDate(userName: String): Unit = {
|
def updateLastLoginDate(userName: String): Unit =
|
||||||
val q = for {
|
Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate)
|
||||||
a <- Accounts if a.userName is userName.bind
|
.update(new java.sql.Date(System.currentTimeMillis))
|
||||||
} yield a.lastLoginDate
|
|
||||||
|
|
||||||
q.update(new java.sql.Date(System.currentTimeMillis))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user