Updating oauth form validation per PR feedback. T712

pull/232/head
Nick Gerakines 5 years ago
parent 5e76565271
commit 6d79ed3cfd
  1. 11
      oauth_signup.go

@ -125,21 +125,18 @@ func (h oauthHandler) viewOauthSignup(app *App, w http.ResponseWriter, r *http.R
func (h oauthHandler) validateOauthSignup(r *http.Request) error { func (h oauthHandler) validateOauthSignup(r *http.Request) error {
username := r.FormValue(oauthParamUsername) username := r.FormValue(oauthParamUsername)
if len(username) < 5 { if len(username) < h.Config.App.MinUsernameLen {
return impart.HTTPError{Status: http.StatusBadRequest, Message: "Username is too short."} return impart.HTTPError{Status: http.StatusBadRequest, Message: "Username is too short."}
} }
if len(username) > 20 { if len(username) > 100 {
return impart.HTTPError{Status: http.StatusBadRequest, Message: "Username is too long."} return impart.HTTPError{Status: http.StatusBadRequest, Message: "Username is too long."}
} }
alias := r.FormValue(oauthParamAlias) alias := r.FormValue(oauthParamAlias)
if len(alias) < 5 { if len(alias) == 0 {
return impart.HTTPError{Status: http.StatusBadRequest, Message: "Alias is too short."} return impart.HTTPError{Status: http.StatusBadRequest, Message: "Alias is too short."}
} }
if len(alias) > 20 {
return impart.HTTPError{Status: http.StatusBadRequest, Message: "Alias is too long."}
}
password := r.FormValue("password") password := r.FormValue("password")
if len(password) < 5 { if len(password) == 0 {
return impart.HTTPError{Status: http.StatusBadRequest, Message: "Password is too short."} return impart.HTTPError{Status: http.StatusBadRequest, Message: "Password is too short."}
} }
email := r.FormValue(oauthParamEmail) email := r.FormValue(oauthParamEmail)

Loading…
Cancel
Save