Add mixxing Recovery field on User object

This commit is contained in:
James Mills
2021-01-30 15:42:27 +10:00
parent 3362aebbc1
commit 35fd594477
2 changed files with 2 additions and 8 deletions

View File

@@ -12,9 +12,10 @@ import (
type User struct {
Username string
Password string
Email string
CreatedAt time.Time
Recovery string `default:"auto"`
Tokens []string `default:"[]"`
}

View File

@@ -26,13 +26,6 @@ func (s *Server) ResetPasswordHandler() httprouter.Handle {
email := strings.TrimSpace(r.FormValue("email"))
recovery := fmt.Sprintf("email:%s", FastHash(email))
if err := ValidateUsername(username); err != nil {
ctx.Error = true
ctx.Message = fmt.Sprintf("Username validation failed: %s", err.Error())
s.render("error", w, ctx)
return
}
// Check if user exist
if !s.db.HasUser(username) {
ctx.Error = true