mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-05 06:43:21 +00:00
redirect frontpage login errors
This commit is contained in:
parent
b6ce673292
commit
9525c1ff4d
|
@ -893,10 +893,15 @@ func UserOp(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(fmt.Sprintf("%v", err), "missing_totp_token") {
|
if strings.Contains(fmt.Sprintf("%v", err), "missing_totp_token") {
|
||||||
state.Op = "2fa"
|
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.Status = http.StatusUnauthorized
|
||||||
|
state.Error = err
|
||||||
|
Render(w, "login.html", state)
|
||||||
|
return
|
||||||
} else if resp.JWT.IsValid() {
|
} else if resp.JWT.IsValid() {
|
||||||
state.GetUser(r.FormValue("username"))
|
state.GetUser(r.FormValue("username"))
|
||||||
if state.User != nil {
|
if state.User != nil {
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
{{ if ne .Op "2fa" }}
|
{{ if ne .Op "2fa" }}
|
||||||
<div>
|
<div>
|
||||||
<h2>create a new account</h2>
|
<h2>create a new account</h2>
|
||||||
<form method="POST">
|
<form method="POST" action="/{{ .Host}}/login">
|
||||||
<label>
|
<label>
|
||||||
username
|
username
|
||||||
<div><input required name="username" type="text"></div>
|
<div><input required name="username" type="text"></div>
|
||||||
|
|
Loading…
Reference in a new issue