Improve sign up
- Add server-side validation - Normalize usernames - Check username existence when signing up - Tailor UI to whether federation is enabled or not - Return user to form and show errors on sign up
This commit is contained in:
@@ -34,9 +34,18 @@ func handleWebSignup(app *app, w http.ResponseWriter, r *http.Request) error {
|
||||
}
|
||||
}
|
||||
ur.Web = true
|
||||
ur.Normalize = true
|
||||
|
||||
_, err := signupWithRegistration(app, ur, w, r)
|
||||
if err != nil {
|
||||
if err, ok := err.(impart.HTTPError); ok {
|
||||
session, _ := app.sessionStore.Get(r, cookieName)
|
||||
if session != nil {
|
||||
session.AddFlash(err.Message)
|
||||
session.Save(r, w)
|
||||
return impart.HTTPError{http.StatusFound, "/"}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
return impart.HTTPError{http.StatusFound, "/"}
|
||||
|
Reference in New Issue
Block a user