mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-24 05:39:46 +02:00
feat(user): allow renaming security keys (webauthn/passkey) (#39413)
Closes https://github.com/go-gitea/gitea/issues/39287 Security key nicknames could only be set at registration, so a skipped nickname left an auto-generated hex name until the key was re-registered. Each key now has a Rename button opening a dialog with the current nickname. A nickname used by another of the user's keys (case-insensitive) or a blank nickname is rejected. Renames are recorded as `user:webauth:rename` audit events. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
17 files changed
+142
-21
No files matched your search
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
<div class="item-trailing">
|
||||
<button type="button" class="ui red tiny button link-action" data-modal-confirm="#delete-account-link" data-url="{{AppSubUrl}}/user/settings/security/account_link?id={{$loginSource.ID}}">
|
||||
{{ctx.Locale.Tr "settings.delete_key"}}
|
||||
{{ctx.Locale.Tr "remove"}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
{{end}}
|
||||
</form>
|
||||
<button type="button" class="ui red tiny button link-action" data-modal-confirm="#delete-openid" data-url="{{AppSubUrl}}/user/settings/security/openid/delete?id={{.ID}}">
|
||||
{{ctx.Locale.Tr "settings.delete_key"}}
|
||||
{{ctx.Locale.Tr "remove"}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,13 +16,18 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-trailing">
|
||||
<button type="button" class="ui tiny button show-modal" data-modal="#rename-webauthn-nickname" data-modal-id="{{.ID}}" data-modal-name="{{.Name}}">
|
||||
{{ctx.Locale.Tr "rename"}}
|
||||
</button>
|
||||
<button type="button" class="ui red tiny button link-action" data-modal-confirm="#delete-registration" data-url="{{$.Link}}/webauthn/delete?id={{.ID}}">
|
||||
{{ctx.Locale.Tr "settings.delete_key"}}
|
||||
{{ctx.Locale.Tr "remove"}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui attached segment">
|
||||
<div class="ui form">
|
||||
<div class="required field">
|
||||
<label for="nickname">{{ctx.Locale.Tr "settings.webauthn_nickname"}}</label>
|
||||
@@ -30,6 +35,20 @@
|
||||
</div>
|
||||
<button type="button" id="register-webauthn" class="ui primary button">{{svg "octicon-key"}} {{ctx.Locale.Tr "settings.webauthn_register_key"}}</button>
|
||||
</div>
|
||||
<div class="ui small modal" id="rename-webauthn-nickname">
|
||||
<div class="header">
|
||||
{{svg "octicon-pencil"}}
|
||||
{{ctx.Locale.Tr "rename"}}
|
||||
</div>
|
||||
<form class="content ui form form-fetch-action" action="{{$.Link}}/webauthn/rename" method="post">
|
||||
<input type="hidden" name="id">
|
||||
<div class="required field">
|
||||
<label>{{ctx.Locale.Tr "settings.webauthn_nickname"}}</label>
|
||||
<input name="name" type="text" maxlength="255" required>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
|
||||
</form>
|
||||
</div>
|
||||
<div class="ui small modal" id="delete-registration">
|
||||
<div class="header">
|
||||
{{svg "octicon-trash"}}
|
||||
|
||||
Reference in new issue
Block a user