+ User.ResetPassword

This commit is contained in:
Andreas Schulte 2024-06-10 21:33:16 +02:00
parent 5972bb3a88
commit 6ce1dfd94c
Signed by: andreas
GPG Key ID: E123DA7BD8F9C8AB

View File

@ -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")