mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-13 18:31:28 +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) {
|
||||
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.
|
||||
|
@ -11,7 +11,7 @@ type SignUpController struct {
|
||||
|
||||
// Get renders sign up page
|
||||
func (suc *SignUpController) Get() {
|
||||
if suc.AuthMode != "db_auth" {
|
||||
if suc.AuthMode != "db_auth" || !suc.SelfRegistration {
|
||||
suc.CustomAbort(http.StatusUnauthorized, "Status unauthorized.")
|
||||
}
|
||||
suc.Data["AddNew"] = false
|
||||
|
@ -46,7 +46,7 @@
|
||||
<div class="col-sm-offset-1 col-sm-10">
|
||||
<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>
|
||||
{{ 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>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user