mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-24 01:27:49 +01:00
Merge pull request #11672 from reasonerjt/restrict-userexists
Enable userExists only when self-registration is turned on.
This commit is contained in:
commit
4c41ac81d9
@ -122,6 +122,14 @@ func (cc *CommonController) LogOut() {
|
|||||||
|
|
||||||
// UserExists checks if user exists when user input value in sign in form.
|
// UserExists checks if user exists when user input value in sign in form.
|
||||||
func (cc *CommonController) UserExists() {
|
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")
|
target := cc.GetString("target")
|
||||||
value := cc.GetString("value")
|
value := cc.GetString("value")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user