feat: change user password

This commit is contained in:
2026-08-29 17:23:25 +02:00
parent 67f5d43a58
commit dc71ff4332
5 changed files with 97 additions and 9 deletions
+12
View File
@@ -40,6 +40,18 @@ func (r *UserRepo) CreateUser(ctx context.Context, email string, name string, pa
return user, nil
}
func (r *UserRepo) ChangePassword(ctx context.Context, userID string, passwordHash string) error {
_, err := r.db.ExecContext(ctx,
"UPDATE users SET password_hash = $1 WHERE id = $2",
passwordHash, userID,
)
if err != nil {
return fmt.Errorf("failed to update user: %w", err)
}
return nil
}
func (r *UserRepo) GetUserByEmail(ctx context.Context, email string) (*domain.User, error) {
user := &domain.User{}