fix wrong variable name
This commit is contained in:
parent
b40922f4d4
commit
3d79f59671
1 changed files with 3 additions and 3 deletions
|
@ -172,9 +172,9 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove newline characters from form.KeyContent
|
// Remove newline characters from form.KeyContent
|
||||||
cleanKeyContent := strings.Replace(form.KeyContent, "\n", "", -1)
|
cleanContent := strings.Replace(form.Content, "\n", "", -1)
|
||||||
|
|
||||||
if ok, err := models.CheckPublicKeyString(cleanKeyContent); !ok {
|
if ok, err := models.CheckPublicKeyString(cleanContent); !ok {
|
||||||
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
|
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
|
||||||
ctx.Redirect("/user/settings/ssh")
|
ctx.Redirect("/user/settings/ssh")
|
||||||
return
|
return
|
||||||
|
@ -183,7 +183,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
||||||
k := &models.PublicKey{
|
k := &models.PublicKey{
|
||||||
OwnerId: ctx.User.Id,
|
OwnerId: ctx.User.Id,
|
||||||
Name: form.SSHTitle,
|
Name: form.SSHTitle,
|
||||||
Content: cleanKeyContent,
|
Content: cleanContent,
|
||||||
}
|
}
|
||||||
if err := models.AddPublicKey(k); err != nil {
|
if err := models.AddPublicKey(k); err != nil {
|
||||||
if err == models.ErrKeyAlreadyExist {
|
if err == models.ErrKeyAlreadyExist {
|
||||||
|
|
Loading…
Reference in a new issue