Merge pull request #11672 from reasonerjt/restrict-userexists

Enable userExists only when self-registration is turned on.
This commit is contained in:
Daniel Jiang 2020-04-21 13:19:20 +08:00 committed by GitHub
commit 4c41ac81d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,6 +122,14 @@ func (cc *CommonController) LogOut() {
// UserExists checks if user exists when user input value in sign in form.
func (cc *CommonController) UserExists() {
flag, err := config.SelfRegistration()
if err != nil {
log.Errorf("Failed to get the status of self registration flag, error: %v, disabling user existence check", err)
}
if !flag {
cc.CustomAbort(http.StatusPreconditionFailed, "self registration disabled.")
}
target := cc.GetString("target")
value := cc.GetString("value")