UserInput.Sanitize - don't convert a password to lowercase
This commit is contained in:
parent
12d8fb51f4
commit
16caa7bbe9
|
@ -3,7 +3,6 @@ package usecase
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/zdam-egzamin-zawodowy/backend/internal/auth"
|
||||
"github.com/zdam-egzamin-zawodowy/backend/internal/auth/jwt"
|
||||
"github.com/zdam-egzamin-zawodowy/backend/internal/models"
|
||||
|
@ -77,7 +76,7 @@ func (ucase *usecase) GetUserByCredentials(ctx context.Context, email, password
|
|||
|
||||
user := users[0]
|
||||
if err := user.CompareHashAndPassword(password); err != nil {
|
||||
return nil, fmt.Errorf(messageInvalidCredentials)
|
||||
return nil, errorutils.Wrap(err, messageInvalidCredentials)
|
||||
}
|
||||
|
||||
return user, nil
|
||||
|
|
|
@ -73,7 +73,7 @@ func (input *UserInput) Sanitize() *UserInput {
|
|||
*input.DisplayName = strings.TrimSpace(*input.DisplayName)
|
||||
}
|
||||
if input.Password != nil {
|
||||
*input.Password = strings.ToLower(strings.TrimSpace(*input.Password))
|
||||
*input.Password = strings.TrimSpace(*input.Password)
|
||||
}
|
||||
if input.Email != nil {
|
||||
*input.Email = strings.ToLower(strings.TrimSpace(*input.Email))
|
||||
|
|
Reference in New Issue