mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
Change java.sql.Date to java.sql.Timestamp.
This commit is contained in:
@@ -38,7 +38,7 @@ trait AccountControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
post("/:userName/_edit", form)(ownerOnly { form =>
|
post("/:userName/_edit", form)(ownerOnly { form =>
|
||||||
val userName = params("userName")
|
val userName = params("userName")
|
||||||
val currentDate = new java.sql.Date(System.currentTimeMillis)
|
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
||||||
updateAccount(getAccountByUserName(userName).get.copy(
|
updateAccount(getAccountByUserName(userName).get.copy(
|
||||||
mailAddress = form.mailAddress,
|
mailAddress = form.mailAddress,
|
||||||
url = form.url,
|
url = form.url,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ trait UsersControllerBase extends ControllerBase { self: AccountService with Adm
|
|||||||
})
|
})
|
||||||
|
|
||||||
post("/admin/users/_new", newForm)(adminOnly { form =>
|
post("/admin/users/_new", newForm)(adminOnly { form =>
|
||||||
val currentDate = new java.sql.Date(System.currentTimeMillis)
|
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
||||||
createAccount(Account(
|
createAccount(Account(
|
||||||
userName = form.userName,
|
userName = form.userName,
|
||||||
password = form.password,
|
password = form.password,
|
||||||
@@ -57,7 +57,7 @@ trait UsersControllerBase extends ControllerBase { self: AccountService with Adm
|
|||||||
|
|
||||||
post("/admin/users/:name/_edit", editForm)(adminOnly { form =>
|
post("/admin/users/:name/_edit", editForm)(adminOnly { form =>
|
||||||
val userName = params("userName")
|
val userName = params("userName")
|
||||||
val currentDate = new java.sql.Date(System.currentTimeMillis)
|
val currentDate = new java.sql.Timestamp(System.currentTimeMillis)
|
||||||
updateAccount(getAccountByUserName(userName).get.copy(
|
updateAccount(getAccountByUserName(userName).get.copy(
|
||||||
password = form.password,
|
password = form.password,
|
||||||
mailAddress = form.mailAddress,
|
mailAddress = form.mailAddress,
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ object Accounts extends Table[Account]("ACCOUNT") {
|
|||||||
def password = column[String]("PASSWORD")
|
def password = column[String]("PASSWORD")
|
||||||
def isAdmin = column[Boolean]("ADMINISTRATOR")
|
def isAdmin = column[Boolean]("ADMINISTRATOR")
|
||||||
def url = column[String]("URL")
|
def url = column[String]("URL")
|
||||||
def registeredDate = column[java.sql.Date]("REGISTERED_DATE") // TODO convert java.util.Date later
|
def registeredDate = column[java.sql.Timestamp]("REGISTERED_DATE") // TODO convert java.util.Date later
|
||||||
def updatedDate = column[java.sql.Date]("UPDATED_DATE")
|
def updatedDate = column[java.sql.Timestamp]("UPDATED_DATE")
|
||||||
def lastLoginDate = column[java.sql.Date]("LAST_LOGIN_DATE")
|
def lastLoginDate = column[java.sql.Timestamp]("LAST_LOGIN_DATE")
|
||||||
def * = userName ~ mailAddress ~ password ~ isAdmin ~ url.? ~ registeredDate ~ updatedDate ~ lastLoginDate.? <> (Account, Account.unapply _)
|
def * = userName ~ mailAddress ~ password ~ isAdmin ~ url.? ~ registeredDate ~ updatedDate ~ lastLoginDate.? <> (Account, Account.unapply _)
|
||||||
// def ins = userName ~ mailAddress ~ password ~ userType ~ url.? ~ registeredDate ~ updatedDate ~ lastLoginDate.? <> ({ t => Account(None, t._1, t._2, t._3, t._4, t._5, t._6, t._7, t._8)}, { (o: Account) => Some((o.userName, o.mailAddress, o.password, o.userType, o.url, o.registeredDate, o.updatedDate, o.lastLoginDate))})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Account(
|
case class Account(
|
||||||
@@ -21,9 +20,9 @@ case class Account(
|
|||||||
password: String,
|
password: String,
|
||||||
isAdmin: Boolean,
|
isAdmin: Boolean,
|
||||||
url: Option[String],
|
url: Option[String],
|
||||||
registeredDate: java.sql.Date,
|
registeredDate: java.sql.Timestamp,
|
||||||
updatedDate: java.sql.Date,
|
updatedDate: java.sql.Timestamp,
|
||||||
lastLoginDate: Option[java.sql.Date]
|
lastLoginDate: Option[java.sql.Timestamp]
|
||||||
)
|
)
|
||||||
|
|
||||||
class AccountDao {
|
class AccountDao {
|
||||||
|
|||||||
@@ -28,6 +28,6 @@ trait AccountService {
|
|||||||
|
|
||||||
def updateLastLoginDate(userName: String): Unit =
|
def updateLastLoginDate(userName: String): Unit =
|
||||||
Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate)
|
Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate)
|
||||||
.update(new java.sql.Date(System.currentTimeMillis))
|
.update(new java.sql.Timestamp(System.currentTimeMillis))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@(users: List[model.Account])(implicit context: app.Context)
|
@(users: List[model.Account])(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
|
@import view.helpers
|
||||||
@html.main("Manage Users"){
|
@html.main("Manage Users"){
|
||||||
<div style="text-align: right; margin-bottom: 4px;">
|
<div style="text-align: right; margin-bottom: 4px;">
|
||||||
<a href="@path/admin/users/_new" class="btn">New User</a>
|
<a href="@path/admin/users/_new" class="btn">New User</a>
|
||||||
@@ -26,9 +27,9 @@
|
|||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@account.url</td>
|
<td>@account.url</td>
|
||||||
<td>@account.registeredDate</td>
|
<td>@helpers.datetime(account.registeredDate)</td>
|
||||||
<td>@account.updatedDate</td>
|
<td>@helpers.datetime(account.updatedDate)</td>
|
||||||
<td>@account.lastLoginDate</td>
|
<td>@account.lastLoginDate.map(helpers.datetime)</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user