Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Re-fix signup without email (@Leodmanx2 broke it)

Cette révision appartient à :
sfan5 2017-05-10 15:40:23 +02:00
Parent e94a015b28
révision 18b8082adf
3 fichiers modifiés avec 6 ajouts et 3 suppressions

Voir le fichier

@ -116,6 +116,9 @@ func SetCookieHandler(w http.ResponseWriter, email string, pass string) (int, er
// RegisterHanderFromForm sets cookie from a RegistrationForm. // RegisterHanderFromForm sets cookie from a RegistrationForm.
func RegisterHanderFromForm(w http.ResponseWriter, registrationForm formStruct.RegistrationForm) (int, error) { func RegisterHanderFromForm(w http.ResponseWriter, registrationForm formStruct.RegistrationForm) (int, error) {
email := registrationForm.Email email := registrationForm.Email
if email == "" {
email = registrationForm.Username
}
pass := registrationForm.Password pass := registrationForm.Password
log.Debugf("RegisterHandler UserEmail : %s", email) log.Debugf("RegisterHandler UserEmail : %s", email)
log.Debugf("RegisterHandler UserPassword : %s", pass) log.Debugf("RegisterHandler UserPassword : %s", pass)

Voir le fichier

@ -49,7 +49,7 @@ func IsAgreed(termsAndConditions string) bool { // TODO: Inline function
// RegistrationForm is used when creating a user. // RegistrationForm is used when creating a user.
type RegistrationForm struct { type RegistrationForm struct {
Username string `form:"username" needed:"true" len_min:"3" len_max:"20"` Username string `form:"username" needed:"true" len_min:"3" len_max:"20"`
Email string `form:"email" needed:"true"` Email string `form:"email"`
Password string `form:"password" needed:"true" len_min:"6" len_max:"25" equalInput:"ConfirmPassword"` Password string `form:"password" needed:"true" len_min:"6" len_max:"25" equalInput:"ConfirmPassword"`
ConfirmPassword string `form:"password_confirmation" omit:"true" needed:"true"` ConfirmPassword string `form:"password_confirmation" omit:"true" needed:"true"`
CaptchaID string `form:"captchaID" omit:"true" needed:"true"` CaptchaID string `form:"captchaID" omit:"true" needed:"true"`

Voir le fichier

@ -25,7 +25,7 @@
}, },
{ {
"id":"signup_box_title", "id":"signup_box_title",
"translation": "Registrier dich <small>Es ist kostenlos und wird immer so bleiben.</small>" "translation": "Registriere dich <small>Es ist kostenlos und wird immer so bleiben.</small>"
}, },
{ {
"id":"username", "id":"username",
@ -81,7 +81,7 @@
}, },
{ {
"id":"sign_in_box_title", "id":"sign_in_box_title",
"translation": "Bitte logge dich zuerst ein" "translation": "Bitte logge dich ein"
}, },
{ {
"id":"sign_in_title", "id":"sign_in_title",