Add admin setting to disable user registration - Complete #170

This commit is contained in:
Bubka
2023-04-02 11:17:01 +02:00
parent 5de9a2df27
commit 4f81b30fcd
6 changed files with 37 additions and 1 deletions

View File

@ -30,7 +30,7 @@
<p >{{ $t('auth.sign_in_using') }}&nbsp;
<a id="lnkSignWithWebauthn" role="button" class="is-link" @keyup.enter="toggleForm" @click="toggleForm" tabindex="0" :aria-label="$t('auth.sign_in_using_security_device')">{{ $t('auth.webauthn.security_device') }}</a>
</p>
<p class="mt-4">{{ $t('auth.forms.dont_have_account_yet') }}&nbsp;<router-link id="lnkRegister" :to="{ name: 'register' }" class="is-link">{{ $t('auth.register') }}</router-link></p>
<p v-if="this.$root.appSettings.disableRegistration == false" class="mt-4">{{ $t('auth.forms.dont_have_account_yet') }}&nbsp;<router-link id="lnkRegister" :to="{ name: 'register' }" class="is-link">{{ $t('auth.register') }}</router-link></p>
</div>
</form-wrapper>
<!-- footer -->
@ -178,6 +178,11 @@
clean: true
})
clearInterval(this.csrfRefresher);
if (this.$root.appSettings.disableRegistration && to.name == 'register') {
this.$router.push({name: 'genericError', params: { err: this.$t('errors.unauthorized_legend') } })
}
next()
}
}

View File

@ -61,6 +61,8 @@
<version-checker></version-checker>
<!-- protect db -->
<form-checkbox v-on:useEncryption="saveSetting('useEncryption', $event)" :form="settingsForm" fieldName="useEncryption" :label="$t('settings.forms.use_encryption.label')" :help="$t('settings.forms.use_encryption.help')" />
<!-- disable registration -->
<form-checkbox v-on:disableRegistration="saveSetting('disableRegistration', $event)" :form="settingsForm" fieldName="disableRegistration" :label="$t('settings.forms.disable_registration.label')" :help="$t('settings.forms.disable_registration.help')" />
</div>
</form>
</form-wrapper>
@ -122,6 +124,7 @@
settings: {
useEncryption: null,
checkForUpdate: null,
disableRegistration: null,
},
layouts: [
{ text: this.$t('settings.forms.grid'), value: 'grid', icon: 'th' },