mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 04:31:36 +08:00
Users: Disable users removed from LDAP (#16820)
* Users: add is_disabled column * Users: disable users removed from LDAP * Auth: return ErrInvalidCredentials for failed LDAP auth * User: return isDisabled flag in user search api * User: mark disabled users at the server admin page * Chore: refactor according to review * Auth: prevent disabled user from login * Auth: re-enable user when it found in ldap * User: add api endpoint for disabling user * User: use separate endpoints to disable/enable user * User: disallow disabling external users * User: able do disable users from admin UI * Chore: refactor based on review * Chore: use more clear error check when disabling user * Fix login tests * Tests for disabling user during the LDAP login * Tests for disable user API * Tests for login with disabled user * Remove disable user UI stub * Sync with latest LDAP refactoring
This commit is contained in:
@ -105,6 +105,10 @@ func (hs *HTTPServer) LoginPost(c *m.ReqContext, cmd dtos.LoginCommand) Response
|
||||
return Error(401, "Invalid username or password", err)
|
||||
}
|
||||
|
||||
if err == login.ErrUserDisabled {
|
||||
return Error(401, "User is disabled", err)
|
||||
}
|
||||
|
||||
return Error(500, "Error while trying to authenticate user", err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user