mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
Remove currentDate from controller.
This commit is contained in:
@@ -36,18 +36,7 @@ trait UsersControllerBase extends ControllerBase { self: AccountService with Adm
|
|||||||
})
|
})
|
||||||
|
|
||||||
post("/admin/users/_new", newForm)(adminOnly { form =>
|
post("/admin/users/_new", newForm)(adminOnly { form =>
|
||||||
// TODO I want to ban to use the currentDate in Controller.
|
createAccount(form.userName, form.password, form.mailAddress, form.isAdmin, form.url)
|
||||||
val currentDate = new java.util.Date()
|
|
||||||
createAccount(Account(
|
|
||||||
userName = form.userName,
|
|
||||||
password = form.password,
|
|
||||||
mailAddress = form.mailAddress,
|
|
||||||
isAdmin = form.isAdmin,
|
|
||||||
url = form.url,
|
|
||||||
registeredDate = currentDate,
|
|
||||||
updatedDate = currentDate,
|
|
||||||
lastLoginDate = None))
|
|
||||||
|
|
||||||
redirect("/admin/users")
|
redirect("/admin/users")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,16 @@ trait AccountService {
|
|||||||
|
|
||||||
def getAllUsers(): List[Account] = Query(Accounts) sortBy(_.userName) list
|
def getAllUsers(): List[Account] = Query(Accounts) sortBy(_.userName) list
|
||||||
|
|
||||||
def createAccount(account: Account): Unit = Accounts insert account
|
def createAccount(userName: String, password: String, mailAddress: String, isAdmin: Boolean, url: Option[String]): Unit =
|
||||||
|
Accounts insert Account(
|
||||||
|
userName = userName,
|
||||||
|
password = password,
|
||||||
|
mailAddress = mailAddress,
|
||||||
|
isAdmin = isAdmin,
|
||||||
|
url = url,
|
||||||
|
registeredDate = currentDate,
|
||||||
|
updatedDate = currentDate,
|
||||||
|
lastLoginDate = None)
|
||||||
|
|
||||||
def updateAccount(account: Account): Unit =
|
def updateAccount(account: Account): Unit =
|
||||||
Query(Accounts)
|
Query(Accounts)
|
||||||
|
|||||||
Reference in New Issue
Block a user