Use form for admin purge user (#21070)

Fixes #20998

The basic modal actions were set up for basic confirmation-style modals,
however this modal also has a special form input, which instead requires
a form in the modal itself.
The basic modal actions are indirectly controlled by JS and are simple
`<div>` elements, whereas this requires a `<button>` to submit.

This appears to be similar to how we do it in (for example) the repo
deletion modal.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
John Olheiser 2022-09-12 15:52:17 -05:00 committed by GitHub
parent defc401b27
commit 2854031d87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -151,7 +151,7 @@
<div class="field"> <div class="field">
<button class="ui green button">{{.locale.Tr "admin.users.update_profile"}}</button> <button class="ui green button">{{.locale.Tr "admin.users.update_profile"}}</button>
<div class="ui red button show-modal" data-modal="#delete-user-modal" data-url="{{$.Link}}/delete" data-id="{{.User.ID}}">{{.locale.Tr "admin.users.delete_account"}}</div> <div class="ui red button show-modal" data-modal="#delete-user-modal">{{.locale.Tr "admin.users.delete_account"}}</div>
</div> </div>
</form> </form>
</div> </div>
@ -206,7 +206,6 @@
</div> </div>
<form class="ui form" method="POST" action="{{.Link}}/delete"> <form class="ui form" method="POST" action="{{.Link}}/delete">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<input type="hidden" name="id">
<div class="field"> <div class="field">
<div class="ui checkbox"> <div class="ui checkbox">
<label for="purge">{{.locale.Tr "admin.users.purge"}}</label> <label for="purge">{{.locale.Tr "admin.users.purge"}}</label>
@ -214,7 +213,16 @@
</div> </div>
<p class="help">{{.locale.Tr "admin.users.purge_help"}}</p> <p class="help">{{.locale.Tr "admin.users.purge_help"}}</p>
</div> </div>
{{template "base/delete_modal_actions" .}} <div class="actions">
<div class="ui red basic inverted cancel button">
{{svg "octicon-x"}}
{{.locale.Tr "modal.no"}}
</div>
<button class="ui green basic inverted ok button">
{{svg "octicon-check"}}
{{.locale.Tr "modal.yes"}}
</button>
</div>
</form> </form>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}