fix (plg_authenticate_local): bcrypt edge case

This commit is contained in:
MickaelK 2025-11-18 01:11:22 +11:00
parent 9b7b77206b
commit 26c79ce122

View file

@ -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
} }