From 6d79ed3cfdf3e2fcc80ed4938c68a5b04d85dcb0 Mon Sep 17 00:00:00 2001 From: Nick Gerakines Date: Tue, 7 Jan 2020 21:52:51 -0500 Subject: [PATCH] Updating oauth form validation per PR feedback. T712 --- oauth_signup.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/oauth_signup.go b/oauth_signup.go index 53ad5c4..cf90af6 100644 --- a/oauth_signup.go +++ b/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 { 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."} } - if len(username) > 20 { + if len(username) > 100 { return impart.HTTPError{Status: http.StatusBadRequest, Message: "Username is too long."} } alias := r.FormValue(oauthParamAlias) - if len(alias) < 5 { + if len(alias) == 0 { 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") - if len(password) < 5 { + if len(password) == 0 { return impart.HTTPError{Status: http.StatusBadRequest, Message: "Password is too short."} } email := r.FormValue(oauthParamEmail)