diff --git a/src/main/scala/app/AccountController.scala b/src/main/scala/app/AccountController.scala index 86ba9b1..edc2146 100644 --- a/src/main/scala/app/AccountController.scala +++ b/src/main/scala/app/AccountController.scala @@ -184,12 +184,19 @@ 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 } diff --git a/src/main/scala/service/SshKeyService.scala b/src/main/scala/service/SshKeyService.scala index 45dff43..c249a3a 100644 --- a/src/main/scala/service/SshKeyService.scala +++ b/src/main/scala/service/SshKeyService.scala @@ -12,4 +12,8 @@ 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 + + } diff --git a/src/main/twirl/account/register.scala.html b/src/main/twirl/account/register.scala.html new file mode 100644 index 0000000..7bce2db --- /dev/null +++ b/src/main/twirl/account/register.scala.html @@ -0,0 +1,48 @@ +@()(implicit context: app.Context) +@import context._ +@import view.helpers._ +@html.main("Create your account"){ +

Create your account

+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + @helper.html.uploadavatar(None) +
+
+
+
+ +
+
+} diff --git a/src/main/twirl/account/ssh.scala.html b/src/main/twirl/account/ssh.scala.html index 82a3d38..c5ac69e 100644 --- a/src/main/twirl/account/ssh.scala.html +++ b/src/main/twirl/account/ssh.scala.html @@ -10,9 +10,9 @@
SSH Keys
- @sshKeys.map { sshKey => - @sshKey.title - Delete + @sshKeys.map { key => + @key.title + Delete }