Skip to content

Commit

Permalink
Fix key signature error page (go-gitea#22229)
Browse files Browse the repository at this point in the history
- Backport of go-gitea#22229
  - When the GPG key contains an error, such as an invalid signature or an email address that does not match the user.A page will be shown that says you must provide a signature for the token.
  - This page had two errors: one had the wrong translation key and the other tried to use an undefined variable [`.PaddedKeyID`](https://github.com/go-gitea/gitea/blob/e81ccc406bf723a5a58d685e7782f281736affd4/models/asymkey/gpg_key.go#L65-L72), which is a function implemented on the `GPGKey` struct, given that we don't have that, we use [`KeyID`](https://github.com/go-gitea/gitea/blob/e81ccc406bf723a5a58d685e7782f281736affd4/routers/web/user/setting/keys.go#L102) which is [the fingerprint of the publickey](https://pkg.go.dev/golang.org/x/crypto/openpgp/packet#PublicKey.KeyIdString) and is a valid way for opengpg to refer to a key.
  • Loading branch information
Gusted committed Dec 23, 2022
1 parent 72524ad commit b0bb248
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions templates/user/settings/keys_gpg.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<p>{{.locale.Tr "settings.gpg_token_required"}}</p>
</div>
<div class="field">
<label for="token">{{.locale.Tr "setting.gpg_token"}}
<label for="token">{{.locale.Tr "settings.gpg_token"}}
<input readonly="" value="{{.TokenToSign}}">
<div class="help">
<p>{{.locale.Tr "settings.gpg_token_help"}}</p>
<p><code>{{$.locale.Tr "settings.gpg_token_code" .TokenToSign .PaddedKeyID}}</code></p>
<p><code>{{$.locale.Tr "settings.gpg_token_code" .TokenToSign .KeyID}}</code></p>
</div>
</div>
<div class="field">
Expand Down

0 comments on commit b0bb248

Please sign in to comment.