mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-18 21:01:27 +01:00
fixed self registration unchecked.
This commit is contained in:
parent
9b106d223d
commit
3fe35c0f9b
@ -107,6 +107,12 @@ func (b *BaseController) Prepare() {
|
|||||||
if _, err := os.Stat(filepath.Join("static", "resources", "js", "harbor.app.min.js")); os.IsNotExist(err) {
|
if _, err := os.Stat(filepath.Join("static", "resources", "js", "harbor.app.min.js")); os.IsNotExist(err) {
|
||||||
b.UseCompressedJS = false
|
b.UseCompressedJS = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selfRegistration := strings.ToLower(os.Getenv("SELF_REGISTRATION"))
|
||||||
|
if selfRegistration == "on" {
|
||||||
|
b.SelfRegistration = true
|
||||||
|
}
|
||||||
|
b.Data["SelfRegistration"] = b.SelfRegistration
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forward to setup layout and template for content for a page.
|
// Forward to setup layout and template for content for a page.
|
||||||
|
@ -11,7 +11,7 @@ type SignUpController struct {
|
|||||||
|
|
||||||
// Get renders sign up page
|
// Get renders sign up page
|
||||||
func (suc *SignUpController) Get() {
|
func (suc *SignUpController) Get() {
|
||||||
if suc.AuthMode != "db_auth" {
|
if suc.AuthMode != "db_auth" || !suc.SelfRegistration {
|
||||||
suc.CustomAbort(http.StatusUnauthorized, "Status unauthorized.")
|
suc.CustomAbort(http.StatusUnauthorized, "Status unauthorized.")
|
||||||
}
|
}
|
||||||
suc.Data["AddNew"] = false
|
suc.Data["AddNew"] = false
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
<div class="col-sm-offset-1 col-sm-10">
|
<div class="col-sm-offset-1 col-sm-10">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<button type="submit" class="btn btn-default" ng-click="vm.doSignIn(user)" loading-progress hide-target="false" toggle-in-progress="vm.signInTIP">// 'sign_in' | tr //</button>
|
<button type="submit" class="btn btn-default" ng-click="vm.doSignIn(user)" loading-progress hide-target="false" toggle-in-progress="vm.signInTIP">// 'sign_in' | tr //</button>
|
||||||
{{ if eq .AuthMode "db_auth" }}
|
{{ if and (eq .AuthMode "db_auth") (eq .SelfRegistration true) }}
|
||||||
<button type="button" class="btn btn-success" ng-click="vm.doSignUp()">// 'sign_up' | tr //</button>
|
<button type="button" class="btn btn-success" ng-click="vm.doSignUp()">// 'sign_up' | tr //</button>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user