mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
fix (plg_authenticate_local): bcrypt edge case
This commit is contained in:
parent
9b7b77206b
commit
26c79ce122
1 changed files with 5 additions and 1 deletions
|
|
@ -27,7 +27,11 @@ func createUser(user User) error {
|
||||||
if user.Password == "" {
|
if user.Password == "" {
|
||||||
return ErrNotValid
|
return ErrNotValid
|
||||||
}
|
}
|
||||||
p, err := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost)
|
pwd := user.Password
|
||||||
|
if len(pwd) > 72 {
|
||||||
|
pwd = pwd[0:72]
|
||||||
|
}
|
||||||
|
p, err := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.DefaultCost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue