Have got logout working
This commit is contained in:
parent
01c6e9de87
commit
b7e0269e9d
7 changed files with 66 additions and 10 deletions
|
|
@ -34,3 +34,13 @@ func (s *Service) Login(ctx context.Context, username, password string) (models.
|
|||
func (s *Service) GetUser(ctx context.Context, userID int64) (models.User, error) {
|
||||
return s.db.SelectUserByID(ctx, userID)
|
||||
}
|
||||
|
||||
func (s *Service) SetPassword(ctx context.Context, username, password string) (models.User, error) {
|
||||
user, err := s.db.SelectUserByUsername(ctx, username)
|
||||
if err != nil {
|
||||
return models.User{}, err
|
||||
}
|
||||
|
||||
user.SetPassword(password)
|
||||
return user, s.db.SaveUser(ctx, &user)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue