mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-17 09:01:06 +02:00
Add admin setting to disable user registration - Complete #170
This commit is contained in:
@ -30,7 +30,7 @@
|
||||
<p >{{ $t('auth.sign_in_using') }}
|
||||
<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') }} <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') }} <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()
|
||||
}
|
||||
}
|
||||
|
@ -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' },
|
||||
|
Reference in New Issue
Block a user