diff options
author | zeripath <art27@cantab.net> | 2023-02-02 18:25:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-02 18:25:54 +0000 |
commit | 2914c5299b37c3f98997fc923b0b715c9b3f750a (patch) | |
tree | 021346c382be0a3f515009f3a54c9cf57a743007 /routers/web/user/setting | |
parent | ccb38512818dd3ee86f7960ed6cdf34754e4d09f (diff) | |
download | gitea-2914c5299b37c3f98997fc923b0b715c9b3f750a.tar.gz gitea-2914c5299b37c3f98997fc923b0b715c9b3f750a.zip |
Improve error report when user passes a private key (#22726)
The error reported when a user passes a private ssh key as their ssh
public key is not very nice.
This PR improves this slightly.
Ref #22693
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'routers/web/user/setting')
-rw-r--r-- | routers/web/user/setting/keys.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/web/user/setting/keys.go b/routers/web/user/setting/keys.go index 0ecc39ecd1..6debf95bbc 100644 --- a/routers/web/user/setting/keys.go +++ b/routers/web/user/setting/keys.go @@ -159,6 +159,8 @@ func KeysPost(ctx *context.Context) { ctx.Flash.Info(ctx.Tr("settings.ssh_disabled")) } else if asymkey_model.IsErrKeyUnableVerify(err) { ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key")) + } else if err == asymkey_model.ErrKeyIsPrivate { + ctx.Flash.Error(ctx.Tr("form.must_use_public_key")) } else { ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error())) } |