diff --git a/models.go b/models.go index 2bc016e..b44660b 100644 --- a/models.go +++ b/models.go @@ -46,6 +46,12 @@ func (u User) IsUsingThisPassword(password string) bool { return generatePasswordHash(password, u.Salt) == u.PasswordHash } +func (u User) ResetPassword(newPassword string) (User, error) { + u.PasswordHash = generatePasswordHash(newPassword, u.Salt) + + return u, nil +} + func (g Group) AddMember(u User) (Group, error) { if !utils.IsValidUUID(u.UUID) { return g, errors.New("unvalid UUID")