auth: fix NoPassWord check when add user

This commit is contained in:
yoyinzyc 2019-12-03 16:25:49 -08:00
parent ac63c2fbd0
commit 4a9247a47e

View File

@ -388,7 +388,8 @@ func (as *authStore) UserAdd(r *pb.AuthUserAddRequest) (*pb.AuthUserAddResponse,
var hashed []byte
var err error
if r.Options != nil && !r.Options.NoPassword {
noPassword := r.Options != nil && r.Options.NoPassword
if !noPassword {
hashed, err = bcrypt.GenerateFromPassword([]byte(r.Password), as.bcryptCost)
if err != nil {
if as.lg != nil {