redirect frontpage login errors

This commit is contained in:
Ryan Stafford 2023-07-23 15:05:31 -04:00
parent b6ce673292
commit 9525c1ff4d
2 changed files with 8 additions and 3 deletions

View file

@ -893,10 +893,15 @@ func UserOp(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
if err != nil {
if strings.Contains(fmt.Sprintf("%v", err), "missing_totp_token") {
state.Op = "2fa"
Render(w, "login.html", state)
return
}
state.GetSite()
if state.Site != nil && state.Site.SiteView.LocalSite.CaptchaEnabled {
state.GetCaptcha()
}
state.Status = http.StatusUnauthorized
state.Error = err
Render(w, "login.html", state)
return
} else if resp.JWT.IsValid() {
state.GetUser(r.FormValue("username"))
if state.User != nil {

View file

@ -38,7 +38,7 @@
{{ if ne .Op "2fa" }}
<div>
<h2>create a new account</h2>
<form method="POST">
<form method="POST" action="/{{ .Host}}/login">
<label>
username
<div><input required name="username" type="text"></div>