Fix registration without email
Cette révision appartient à :
Parent
128b070968
révision
c78eaacf0c
2 fichiers modifiés avec 7 ajouts et 4 suppressions
|
@ -118,6 +118,9 @@ func SetCookieHandler(w http.ResponseWriter, email string, pass string) (int, er
|
|||
// RegisterHanderFromForm sets cookie from a RegistrationForm.
|
||||
func RegisterHanderFromForm(w http.ResponseWriter, registrationForm formStruct.RegistrationForm) (int, error) {
|
||||
email := registrationForm.Email
|
||||
if email == "" {
|
||||
email = registrationForm.Username
|
||||
}
|
||||
pass := registrationForm.Password
|
||||
log.Debugf("RegisterHandler UserEmail : %s", email)
|
||||
log.Debugf("RegisterHandler UserPassword : %s", pass)
|
||||
|
|
|
@ -46,14 +46,14 @@ func SuggestUsername(username string) string {
|
|||
|
||||
func CheckEmail(email string) bool {
|
||||
if len(email) == 0 {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
var count int
|
||||
db.ORM.Model(model.User{}).Where("email = ?", email).Count(&count)
|
||||
if count == 0 {
|
||||
return false // duplicate
|
||||
if count != 0 {
|
||||
return true // error: duplicate
|
||||
}
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
// CreateUserFromForm creates a user from a registration form.
|
||||
|
|
Référencer dans un nouveau ticket