1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

add publickey

This commit is contained in:
Lunny Xiao
2014-02-25 18:30:48 +08:00
parent d42c194aad
commit 52984f85d5
4 changed files with 24 additions and 9 deletions

View File

@@ -21,9 +21,16 @@ func AddPublickKey(req *http.Request, r render.Render) {
return
}
k := &models.PublicKey{}
err := models.AddPublicKey(k, "")
r.HTML(403, "status/403", map[string]interface{}{
"Title": fmt.Sprintf("%v", err),
})
k := &models.PublicKey{OwnerId: 1,
Name: req.FormValue("keyname"),
Content: req.FormValue("key_content"),
}
err := models.AddPublicKey(k)
if err != nil {
r.HTML(403, "status/403", map[string]interface{}{
"Title": fmt.Sprintf("%v", err),
})
} else {
r.HTML(200, "user/publickey_added", map[string]interface{}{})
}
}