Ver a proveniência

Updating oauth form validation per PR feedback. T712

pull/232/head
Nick Gerakines há 4 anos
ascendente
cometimento
6d79ed3cfd
1 ficheiros alterados com 4 adições e 7 eliminações
  1. +4
    -7
      oauth_signup.go

+ 4
- 7
oauth_signup.go Ver ficheiro

@@ -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)


Carregando…
Cancelar
Guardar