mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Fix regression in integration page and simplify SQL query
This commit is contained in:
parent
309e6d1084
commit
7988241e11
4 changed files with 72 additions and 174 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue