Skip to content

Commit f587b7a

Browse files
committed
feat: integrate internationalization for error messages in TwoFactorsConfirmation and TwoFactorsSetup components
1 parent 549a14a commit f587b7a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

custom/TwoFactorsConfirmation.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
import { LinkButton } from '@/afcl';
5454
import Vue2FACodeInput from '@loltech/vue3-2fa-code-input';
5555
import VOtpInput from "vue3-otp-input";
56+
import { useI18n } from 'vue-i18n';
5657
58+
const { t } = useI18n();
5759
const code = ref(null);
5860
5961
const handleOnComplete = (value) => {
@@ -118,7 +120,7 @@
118120
if (resp.allowedLogin){
119121
await user.finishLogin();
120122
} else {
121-
showErrorTost('Invalid code');
123+
showErrorTost(t('Invalid code'));
122124
}
123125
}
124126

custom/TwoFactorsSetup.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ import { Button, LinkButton } from '@/afcl';
7878
import Vue2FACodeInput from '@loltech/vue3-2fa-code-input';
7979
import VOtpInput from "vue3-otp-input";
8080
import adminforth from '@/adminforth';
81+
import { useI18n } from 'vue-i18n';
8182
83+
const { t } = useI18n();
8284
8385
const code = ref(null);
8486
const handleOnComplete = (value) => {
@@ -125,7 +127,7 @@ function parseJwt(token) {
125127
126128
function onCopyClick(){
127129
navigator.clipboard.writeText(totp.value.newSecret);
128-
adminforth.alert({message: 'Copied to clipboard', variant: 'success'})
130+
adminforth.alert({message: t('Copied to clipboard'), variant: 'success'})
129131
}
130132
131133
onMounted(async () => {
@@ -170,7 +172,7 @@ async function sendCode (value) {
170172
if (resp.allowedLogin){
171173
await user.finishLogin()
172174
} else {
173-
showErrorTost('Invalid code');
175+
showErrorTost(t('Invalid code'));
174176
}
175177
}
176178
@@ -197,7 +199,7 @@ const handleSkip = async () => {
197199
if (resp.allowedLogin){
198200
await user.finishLogin()
199201
} else {
200-
showErrorTost('Something went wrong');
202+
showErrorTost(t('Something went wrong'));
201203
}
202204
}
203205
</script>

0 commit comments

Comments
 (0)