From 08dc7dd8a613521ca42699bc029e9a305ab2691b Mon Sep 17 00:00:00 2001 From: yoyinzyc Date: Tue, 3 Dec 2019 16:25:49 -0800 Subject: [PATCH] auth: fix NoPassWord check when add user --- auth/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth/store.go b/auth/store.go index c4d24a99c8eb..3c1536229345 100644 --- a/auth/store.go +++ b/auth/store.go @@ -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 {