Skip to content

Commit

Permalink
hide resend verify email button when server disables verify email
Browse files Browse the repository at this point in the history
  • Loading branch information
mayswind committed Sep 10, 2023
1 parent ca14770 commit a32451f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/views/desktop/LoginPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ import { useSettingsStore } from '@/stores/setting.js';
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
import assetConstants from '@/consts/asset.js';
import { isUserRegistrationEnabled, isUserForgetPasswordEnabled } from '@/lib/server_settings.js';
import {
isUserRegistrationEnabled,
isUserForgetPasswordEnabled,
isUserVerifyEmailEnabled
} from '@/lib/server_settings.js';
import {
mdiEyeOutline,
Expand Down Expand Up @@ -244,6 +248,9 @@ export default {
},
currentLanguageName() {
return this.$locale.getCurrentLanguageDisplayName();
},
isUserVerifyEmailEnabled() {
return isUserVerifyEmailEnabled();
}
},
setup() {
Expand Down Expand Up @@ -312,7 +319,7 @@ export default {
}).catch(error => {
self.logining = false;
if (error.error && error.error.errorCode === 201020 && error.error.context && error.error.context.email) {
if (self.isUserVerifyEmailEnabled && error.error && error.error.errorCode === 201020 && error.error.context && error.error.context.email) {
self.$router.push('/verify_email?email=' + encodeURIComponent(error.error.context.email));
return;
}
Expand Down
6 changes: 5 additions & 1 deletion src/views/desktop/user/settings/tabs/UserBasicSettingTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<span v-if="!loading && emailVerified">{{ $t('Email has been verified') }}</span>
<span v-if="!loading && !emailVerified">{{ $t('Email has not been verified') }}</span>
<v-btn class="ml-2 px-2" size="small" variant="text" :disabled="loading || resending"
@click="resendVerifyEmail" v-if="!loading && !emailVerified">
@click="resendVerifyEmail" v-if="isUserVerifyEmailEnabled && !loading && !emailVerified">
{{ $t('Resend Validation Email') }}
<v-progress-circular indeterminate size="18" class="ml-2" v-if="resending"></v-progress-circular>
</v-btn>
Expand Down Expand Up @@ -235,6 +235,7 @@ import { useAccountsStore } from '@/stores/account.js';
import datetimeConstants from '@/consts/datetime.js';
import { getNameByKeyValue } from '@/lib/common.js';
import { getCategorizedAccounts } from '@/lib/account.js';
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.js';
import {
mdiAccount
Expand Down Expand Up @@ -317,6 +318,9 @@ export default {
allTransactionEditScopeTypes() {
return this.$locale.getAllTransactionEditScopeTypes();
},
isUserVerifyEmailEnabled() {
return isUserVerifyEmailEnabled();
},
inputIsNotChanged() {
return !!this.inputIsNotChangedProblemMessage;
},
Expand Down
8 changes: 6 additions & 2 deletions src/views/mobile/users/UserProfilePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
<f7-nav-title :title="$t('User Profile')"></f7-nav-title>
<f7-nav-right class="navbar-compact-icons">
<f7-link icon-f7="ellipsis" :class="{ 'disabled': loading || emailVerified }" @click="showMoreActionSheet = true"></f7-link>
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !isUserVerifyEmailEnabled || loading || emailVerified }" @click="showMoreActionSheet = true"></f7-link>
<f7-link :class="{ 'disabled': inputIsNotChanged || inputIsInvalid || saving }" :text="$t('Save')" @click="save"></f7-link>
</f7-nav-right>
</f7-navbar>
Expand Down Expand Up @@ -212,7 +212,7 @@
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
<f7-actions-group>
<f7-actions-button :class="{ 'disabled': loading || resending }" @click="resendVerifyEmail"
v-if="!loading && !emailVerified"
v-if="isUserVerifyEmailEnabled && !loading && !emailVerified"
>{{ $t('Resend Validation Email') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
Expand Down Expand Up @@ -240,6 +240,7 @@ import { useAccountsStore } from '@/stores/account.js';
import { getNameByKeyValue } from '@/lib/common.js';
import { getCategorizedAccounts } from '@/lib/account.js';
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.js';
export default {
props: [
Expand Down Expand Up @@ -333,6 +334,9 @@ export default {
currentDayOfWeekName() {
return getNameByKeyValue(this.allWeekDays, this.newProfile.firstDayOfWeek, 'type', 'displayName');
},
isUserVerifyEmailEnabled() {
return isUserVerifyEmailEnabled();
},
inputIsNotChanged() {
return !!this.inputIsNotChangedProblemMessage;
},
Expand Down

0 comments on commit a32451f

Please sign in to comment.