mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
(refs #115)Fix account registration page and add public key deletion
This commit is contained in:
@@ -184,12 +184,19 @@ trait AccountControllerBase extends AccountManagementControllerBase {
|
||||
redirect(s"/${userName}/_ssh")
|
||||
})
|
||||
|
||||
get("/:userName/_ssh/delete/:id")(oneselfOnly {
|
||||
val userName = params("userName")
|
||||
val sshKeyId = params("id").toInt
|
||||
deletePublicKey(userName, sshKeyId)
|
||||
redirect(s"/${userName}/_ssh")
|
||||
})
|
||||
|
||||
get("/register"){
|
||||
if(loadSystemSettings().allowAccountRegistration){
|
||||
if(context.loginAccount.isDefined){
|
||||
redirect("/")
|
||||
} else {
|
||||
account.html.edit(None, None)
|
||||
account.html.register()
|
||||
}
|
||||
} else NotFound
|
||||
}
|
||||
|
||||
@@ -12,4 +12,8 @@ trait SshKeyService {
|
||||
def getPublicKeys(userName: String): List[SshKey] =
|
||||
Query(SshKeys).filter(_.userName is userName.bind).sortBy(_.sshKeyId).list
|
||||
|
||||
def deletePublicKey(userName: String, sshKeyId: Int): Unit =
|
||||
SshKeys filter (_.byPrimaryKey(userName, sshKeyId)) delete
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user