Mirror fix on add ssh key

This commit is contained in:
Unknwon 2014-10-11 21:04:42 -04:00
parent fb839ca0fb
commit 452ccff81c
4 changed files with 12 additions and 4 deletions

View file

@ -177,9 +177,13 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
cleanContent := strings.Replace(form.Content, "\n", "", -1)
if ok, err := models.CheckPublicKeyString(cleanContent); !ok {
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
return
if err == models.ErrKeyUnableVerify {
ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key"))
} else {
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
return
}
}
k := &models.PublicKey{