From 6f011ce524636443d5e2c46d70a3d733eaf8837d Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Mon, 20 Apr 2020 01:11:52 +0900 Subject: [PATCH] auth: a new error code for the case of password auth against no password user --- auth/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth/store.go b/auth/store.go index bf3e474bf..3565587a1 100644 --- a/auth/store.go +++ b/auth/store.go @@ -59,6 +59,7 @@ var ( ErrRoleNotFound = errors.New("auth: role not found") ErrRoleEmpty = errors.New("auth: role name is empty") ErrAuthFailed = errors.New("auth: authentication failed, invalid user ID or password") + ErrNoPasswordUser = errors.New("auth: authentication failed, password was given for no password user") ErrPermissionDenied = errors.New("auth: permission denied") ErrRoleNotGranted = errors.New("auth: role is not granted to the user") ErrPermissionNotGranted = errors.New("auth: permission is not granted to the role") @@ -360,7 +361,7 @@ func (as *authStore) CheckPassword(username, password string) (uint64, error) { } if user.Options != nil && user.Options.NoPassword { - return 0, ErrAuthFailed + return 0, ErrNoPasswordUser } return getRevision(tx), nil