diff options
author | 2023-07-10 20:59:49 -0700 | |
---|---|---|
committer | 2023-07-10 21:07:05 -0700 | |
commit | 7988241e11da79dd0f2d88edabfbdee298663b32 (patch) | |
tree | 24139494efb4d8357dbc026ceae9ec85cd1b8385 /storage/user.go | |
parent | 309e6d1084233577a11e086ae3b06927ffb0aae9 (diff) | |
download | v2-7988241e11da79dd0f2d88edabfbdee298663b32.tar.gz v2-7988241e11da79dd0f2d88edabfbdee298663b32.tar.zst v2-7988241e11da79dd0f2d88edabfbdee298663b32.zip |
Fix regression in integration page and simplify SQL query
Diffstat (limited to 'storage/user.go')
-rw-r--r-- | storage/user.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/storage/user.go b/storage/user.go index 5e20cee4..1f074cc9 100644 --- a/storage/user.go +++ b/storage/user.go @@ -9,6 +9,7 @@ import ( "runtime" "strings" + "miniflux.app/crypto" "miniflux.app/logger" "miniflux.app/model" @@ -57,7 +58,7 @@ func (s *Storage) CreateUser(userCreationRequest *model.UserCreationRequest) (*m var hashedPassword string if userCreationRequest.Password != "" { var err error - hashedPassword, err = hashPassword(userCreationRequest.Password) + hashedPassword, err = crypto.HashPassword(userCreationRequest.Password) if err != nil { return nil, err } @@ -157,7 +158,7 @@ func (s *Storage) CreateUser(userCreationRequest *model.UserCreationRequest) (*m // UpdateUser updates a user. func (s *Storage) UpdateUser(user *model.User) error { if user.Password != "" { - hashedPassword, err := hashPassword(user.Password) + hashedPassword, err := crypto.HashPassword(user.Password) if err != nil { return err } @@ -649,8 +650,3 @@ func (s *Storage) HasPassword(userID int64) (bool, error) { } return false, nil } - -func hashPassword(password string) (string, error) { - bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) - return string(bytes), err -} |