support custom tips in login page

This commit is contained in:
MaysWind
2024-11-10 20:50:03 +08:00
parent f87fbddef7
commit f6dd4c03c3
7 changed files with 111 additions and 2 deletions
+15
View File
@@ -1435,6 +1435,20 @@ function getCategorizedAccountsWithDisplayBalance(allVisibleAccounts, showAccoun
return ret;
}
function getServerTipContent(tipConfig, i18nGlobal) {
if (!tipConfig) {
return '';
}
const currentLanguage = getCurrentLanguageTag(i18nGlobal);
if (tipConfig[currentLanguage]) {
return tipConfig[currentLanguage];
}
return tipConfig.default || '';
}
function joinMultiText(textArray, translateFn) {
if (!textArray || !textArray.length) {
return '';
@@ -1707,6 +1721,7 @@ export function i18nFunctions(i18nGlobal) {
getAllSupportedImportFileTypes: () => getAllSupportedImportFileTypes(i18nGlobal, i18nGlobal.t),
getEnableDisableOptions: () => getEnableDisableOptions(i18nGlobal.t),
getCategorizedAccountsWithDisplayBalance: (allVisibleAccounts, showAccountBalance, defaultCurrency, settingsStore, userStore, exchangeRatesStore) => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts, showAccountBalance, defaultCurrency, userStore, settingsStore, exchangeRatesStore, i18nGlobal.t),
getServerTipContent: (tipConfig) => getServerTipContent(tipConfig, i18nGlobal),
joinMultiText: (textArray) => joinMultiText(textArray, i18nGlobal.t),
setLanguage: (locale, force) => setLanguage(i18nGlobal, locale, force),
setTimeZone: (timezone) => setTimeZone(timezone),
+4
View File
@@ -33,6 +33,10 @@ export function isDataImportingEnabled() {
return getServerSetting('i') === 1;
}
export function getLoginPageTips() {
return getServerSetting('lpt');
}
export function getMapProvider() {
return getServerSetting('m');
}
+6 -1
View File
@@ -24,6 +24,7 @@
<v-card-text>
<h4 class="text-h4 mb-2">{{ $t('Welcome to ezBookkeeping') }}</h4>
<p class="mb-0">{{ $t('Please log in with your ezBookkeeping account') }}</p>
<p class="mt-1 mb-0" v-if="tips">{{ tips }}</p>
</v-card-text>
<v-card-text class="pb-0 mb-6">
@@ -179,7 +180,8 @@ import apiConstants from '@/consts/api.js';
import {
isUserRegistrationEnabled,
isUserForgetPasswordEnabled,
isUserVerifyEmailEnabled
isUserVerifyEmailEnabled,
getLoginPageTips
} from '@/lib/server_settings.js';
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
@@ -224,6 +226,9 @@ export default {
isUserForgetPasswordEnabled() {
return isUserForgetPasswordEnabled();
},
tips() {
return this.$locale.getServerTipContent(getLoginPageTips());
},
inputIsEmpty() {
return !this.username || !this.password;
},
+9 -1
View File
@@ -5,6 +5,10 @@
<f7-block class="login-page-tile margin-vertical-half">{{ $t('global.app.title') }}</f7-block>
</f7-login-screen-title>
<f7-list inset v-if="tips">
<f7-block-footer>{{ tips }}</f7-block-footer>
</f7-list>
<f7-list form dividers class="margin-bottom-half">
<f7-list-input
type="text"
@@ -188,7 +192,8 @@ import apiConstants from '@/consts/api.js';
import {
isUserRegistrationEnabled,
isUserForgetPasswordEnabled,
isUserVerifyEmailEnabled
isUserVerifyEmailEnabled,
getLoginPageTips
} from '@/lib/server_settings.js';
import { getDesktopVersionPath } from '@/lib/version.js';
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
@@ -239,6 +244,9 @@ export default {
isUserForgetPasswordEnabled() {
return isUserForgetPasswordEnabled();
},
tips() {
return this.$locale.getServerTipContent(getLoginPageTips());
},
inputIsEmpty() {
return !this.username || !this.password;
},