From 6ce1dfd94cdd951912781e71e82c68831df3d501 Mon Sep 17 00:00:00 2001 From: Andreas Schulte <0x0001f346@pm.me> Date: Mon, 10 Jun 2024 21:33:16 +0200 Subject: [PATCH] + User.ResetPassword --- models.go | 6 ++++++ 1 file changed, 6 insertions(+) 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")