mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
add publickey
This commit is contained in:
@@ -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{}{})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user