Add mixxing Recovery field on User object
This commit is contained in:
@@ -12,9 +12,10 @@ import (
|
|||||||
type User struct {
|
type User struct {
|
||||||
Username string
|
Username string
|
||||||
Password string
|
Password string
|
||||||
Email string
|
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
|
|
||||||
|
Recovery string `default:"auto"`
|
||||||
|
|
||||||
Tokens []string `default:"[]"`
|
Tokens []string `default:"[]"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,13 +26,6 @@ func (s *Server) ResetPasswordHandler() httprouter.Handle {
|
|||||||
email := strings.TrimSpace(r.FormValue("email"))
|
email := strings.TrimSpace(r.FormValue("email"))
|
||||||
recovery := fmt.Sprintf("email:%s", FastHash(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
|
// Check if user exist
|
||||||
if !s.db.HasUser(username) {
|
if !s.db.HasUser(username) {
|
||||||
ctx.Error = true
|
ctx.Error = true
|
||||||
|
|||||||
Reference in New Issue
Block a user