|
|
@ -5,6 +5,8 @@ |
|
|
|
package user |
|
|
|
package user |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/Unknwon/com" |
|
|
|
"github.com/Unknwon/com" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gogits/gogs/models" |
|
|
|
"github.com/gogits/gogs/models" |
|
|
@ -172,7 +174,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Remove newline characters from form.KeyContent
|
|
|
|
// Remove newline characters from form.KeyContent
|
|
|
|
cleanContent := string.Replace(form.Content, "\n", "", -1) |
|
|
|
cleanContent := strings.Replace(form.Content, "\n", "", -1) |
|
|
|
|
|
|
|
|
|
|
|
if ok, err := models.CheckPublicKeyString(cleanContent); !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())) |
|
|
|