Skip to content

Commit

Permalink
mfs i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Feb 21, 2024
1 parent ab5fd5c commit 231d3c5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/components/modal/ModalAuthSettings.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<AppModal>
<template #header>
<h2>Two-factor Authentication</h2>
<h2>{{ translate("MFA.TITLE") }}</h2>
</template>
<template #body>
<Spinner v-if="showSpinner"></Spinner>
Expand Down Expand Up @@ -34,7 +34,7 @@
</thead>
<tbody>
<tr>
<td>Authenticator App</td>
<td>{{ translate("MFA.APP") }}</td>
<td></td>
<td v-if="totpKey.length == 0"></td>
<td v-if="totpKey.length == 1">
Expand All @@ -48,14 +48,14 @@
</td>
</tr>
<tr v-for="(webAuthKey, index) in webAuthKeys">
<td>SecurityKey:&nbsp;{{ webAuthKey.name }}</td>
<td>{{ translate("MFA.KEY") }}:&nbsp;{{ webAuthKey.name }}</td>
<td></td>
<td> <button class="btn btn-danger" @click="removeWebAuthKey(webAuthKey)">Remove</button>
<td> <button class="btn btn-danger" @click="removeWebAuthKey(webAuthKey)">{{ translate("MFA.REMOVE") }}</button>
</td>
</tr>
</tbody>
</table>
<button class="btn btn-success" @click="addWebAuthKey()">Add Security Key</button>
<button class="btn btn-success" @click="addWebAuthKey()">{{ translate("MFA.ADD.KEY") }}</button>
</div>
</template>
</AppModal>
Expand All @@ -68,6 +68,7 @@ const Confirm = require("../confirm/Confirm.vue");
const Spinner = require("../spinner/Spinner.vue");
const Totp = require("../auth/Totp.vue");
const WebAuth = require("../auth/WebAuth.vue");
const i18n = require("../../i18n/index.js");
module.exports = {
components: {
Expand Down Expand Up @@ -98,7 +99,7 @@ module.exports = {
'context'
]),
},
mixins:[],
mixins:[i18n],
created: function() {
let that = this;
this.showSpinner = true;
Expand All @@ -114,7 +115,7 @@ module.exports = {
}
that.showSpinner = false;
}).exceptionally(function(throwable) {
that.$toast.error('Unable to retrieve authentication methods', {timeout:false});
that.$toast.error(that.translate("MFA.ERROR.RETRIEVAL"), {timeout:false});
console.log('Unable to retrieve authentication methods: ' + throwable);
that.showSpinner = false;
});
Expand Down Expand Up @@ -149,14 +150,14 @@ module.exports = {
}
that.showSpinner = false;
}).exceptionally(function(throwable) {
that.$toast.error('Unable to delete authentication method', {timeout:false});
that.$toast.error(that.translate("MFA.ERROR.DELETE"), {timeout:false});
console.log('Unable to delete authentication method: ' + throwable);
that.showSpinner = false;
});
},
addWebAuthKey() {
if (this.webAuthKeys.length + this.totpKey.length >= 10) {
that.$toast.error('Reached maximum number of Security Keys', {timeout:false});
that.$toast.error(that.translate("MFA.MAX.KEYS"), {timeout:false});
} else {
this.showWebAuthSetup = true;
}
Expand Down Expand Up @@ -185,21 +186,21 @@ module.exports = {
}
that.showSpinner = false;
}).exceptionally(function(throwable) {
that.$toast.error('Unable to delete web authentication method', {timeout:false});
that.$toast.error(that.translate("MFA.ERROR.DELETE"), {timeout:false});
console.log('Unable to delete web authentication method: ' + throwable);
that.showSpinner = false;
});
},
confirmRemoveWebAuthKey(name, replaceFunction, cancelFunction) {
this.confirm_message = 'Remove Security Key: ' + name;
this.confirm_body = "Are you sure you want to remove this key?";
this.confirm_message = this.translate("MFA.REMOVE") + " " +this.translate("MFA.KEY") + ': ' + name;
this.confirm_body = this.translate("MFA.CONFIRM.REMOVE.KEY");
this.confirm_consumer_cancel_func = cancelFunction;
this.confirm_consumer_func = replaceFunction;
this.showConfirm = true;
},
confirmRemoveAuthenticatorApp(replaceFunction, cancelFunction) {
this.confirm_message = 'Remove Authenticator App';
this.confirm_body = "Are you sure you want to remove Authenticator App?";
this.confirm_message = this.translate("MFA.REMOVE") + " " +this.translate("MFA.APP");
this.confirm_body = this.translate("MFA.CONFIRM.REMOVE.APP");
this.confirm_consumer_cancel_func = cancelFunction;
this.confirm_consumer_func = replaceFunction;
this.showConfirm = true;
Expand All @@ -218,4 +219,4 @@ module.exports = {
};
</script>
<style>
</style>
</style>
10 changes: 10 additions & 0 deletions src/i18n/en-GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,14 @@ module.exports = {
"PASSWORD.MFA":"Invalid Multi Factor Authenticator code",
"PASSWORD.CHANGED":"Password changed",
"PASSWORD.FIELDS":"All fields must be populated!",
"MFA.TITLE":"Two-factor Authentication",
"MFA.APP":"Authenticator App",
"MFA.KEY":"Security Key",
"MFA.REMOVE":"Remove",
"MFA.ADD.KEY":"Add Security Key",
"MFA.ERROR.RETRIEVAL":"Unable to retrieve authentication methods",
"MFA.ERROR.DELETE":"Unable to delete authentication method",
"MFA.MAX.KEYS":"Reached maximum number of Security Keys",
"MFA.CONFIRM.REMOVE.KEY":"Are you sure you want to remove this key?",
"MFA.CONFIRM.REMOVE.APP":"Are you sure you want to remove Authenticator App?",
}

0 comments on commit 231d3c5

Please sign in to comment.