mirror of
https://github.com/thomiceli/opengist.git
synced 2025-06-13 13:57:13 +02:00
Fix SSH pubkey detection
This commit is contained in:
@ -74,11 +74,12 @@ func sshKeysProcess(ctx echo.Context) error {
|
||||
|
||||
key.UserID = user.ID
|
||||
|
||||
_, _, _, _, err := ssh.ParseAuthorizedKey([]byte(key.Content))
|
||||
pubKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(key.Content))
|
||||
if err != nil {
|
||||
addFlash(ctx, "Invalid SSH key", "error")
|
||||
return redirect(ctx, "/settings")
|
||||
}
|
||||
key.Content = strings.TrimSpace(string(ssh.MarshalAuthorizedKey(pubKey)))
|
||||
|
||||
if err := key.Create(); err != nil {
|
||||
return errorRes(500, "Cannot add SSH key", err)
|
||||
|
Reference in New Issue
Block a user