mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 15:07:33 +08:00
make "create an account" link disabled when user registration is disabled in config
This commit is contained in:
+21
-1
@@ -1,4 +1,8 @@
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const settingsLocalStorageKey = 'lab_user_settings';
|
||||
const serverSettingsCookieKey = 'ACP_SETTINGS';
|
||||
|
||||
const defaultSettings = {
|
||||
lang: 'en'
|
||||
};
|
||||
@@ -37,7 +41,23 @@ function setOption(key, value) {
|
||||
return setSettings(settings);
|
||||
}
|
||||
|
||||
function getServerSetting(key) {
|
||||
const settings = Cookies.get(serverSettingsCookieKey) || '';
|
||||
const settingsArr = settings.split('_');
|
||||
|
||||
for (let i = 0; i < settingsArr.length; i++) {
|
||||
const pairs = settingsArr[i].split('.');
|
||||
|
||||
if (pairs[0] === key) {
|
||||
return pairs[1];
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export default {
|
||||
getLanguage: () => getOriginalOption('lang'),
|
||||
setLanguage: value => setOption('lang', value)
|
||||
setLanguage: value => setOption('lang', value),
|
||||
isUserRegistrationEnabled: () => getServerSetting('r') === '1'
|
||||
};
|
||||
|
||||
@@ -31,6 +31,8 @@ Vue.prototype.$setLanguage = function (locale) {
|
||||
document.querySelector('html').setAttribute('lang', locale);
|
||||
return locale;
|
||||
};
|
||||
Vue.prototype.$isUserRegistrationEnabled = settings.isUserRegistrationEnabled;
|
||||
|
||||
Vue.prototype.$alert = function (message, confirmCallback) {
|
||||
let parameters = {};
|
||||
|
||||
@@ -84,6 +86,7 @@ Vue.prototype.$toast = function (message, timeout) {
|
||||
closeTimeout: timeout || 1500
|
||||
}).open();
|
||||
};
|
||||
|
||||
Vue.prototype.$services = services;
|
||||
Vue.prototype.$user = userstate;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<f7-list-button :class="{ 'disabled': inputIsEmpty }" :text="$t('Log In')" @click="login"></f7-list-button>
|
||||
<f7-block-footer>
|
||||
<span v-t="'Don\'t have an account?'"></span>
|
||||
<f7-link href="/signup" :text="$t('Create an account')"></f7-link>
|
||||
<f7-link :class="{'disabled': !isUserRegistrationEnabled}" href="/signup" :text="$t('Create an account')"></f7-link>
|
||||
<br/>
|
||||
<f7-link class="disabled" href="/forget-pwd" :text="$t('Forget Password?')"></f7-link>
|
||||
</f7-block-footer>
|
||||
@@ -98,6 +98,9 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isUserRegistrationEnabled() {
|
||||
return this.$isUserRegistrationEnabled();
|
||||
},
|
||||
inputIsEmpty() {
|
||||
return !this.username || !this.password;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user