commit bac525f41d591e871a5be22d70dc9b9fa558120e parent 7c25056eca8a5009053da73b267c6761be4bfd05 Author: n0tr1v <n0tr1v@protonmail.com> Date: Thu, 8 Feb 2024 18:53:01 -0800 add reset login attempts button Diffstat:
| M | pkg/web/handlers/admin.go | | | 5 | ++++- |
| M | pkg/web/public/views/pages/admin/user-edit.gohtml | | | 7 | +++++++ |
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/pkg/web/handlers/admin.go b/pkg/web/handlers/admin.go @@ -637,7 +637,10 @@ func AdminEditUserHandler(c echo.Context) error { } formName := c.Request().PostFormValue("formName") - if formName == "reset_tutorial" { + if formName == "reset_login_attempts" { + user.ResetLoginAttempts(db) + return c.Redirect(http.StatusFound, "/admin/users/"+userID.String()+"/edit") + } else if formName == "reset_tutorial" { user.ResetTutorial(db) return c.Redirect(http.StatusFound, "/admin/users/"+userID.String()+"/edit") } diff --git a/pkg/web/public/views/pages/admin/user-edit.gohtml b/pkg/web/public/views/pages/admin/user-edit.gohtml @@ -210,6 +210,13 @@ <input type="submit" class="btn btn-secondary" value="Reset tutorial ({{ .Data.ChatTutorial }})" /> </form> + +<form method="post" class="d-inline"> + <input type="hidden" name="csrf" value="{{ .CSRF }}" /> + <input type="hidden" name="formName" value="reset_login_attempts" /> + <input type="submit" class="btn btn-secondary" value="Reset login attempts ({{ .Data.User.LoginAttempts }})" /> +</form> + <a href="/u/{{ .Data.Username }}" class="btn btn-secondary">Public profile</a> <a href="/admin/users/{{ .Data.User.ID }}/security-logs" class="btn btn-secondary">Security logs</a>