Skip to content

Commit

Permalink
password i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Feb 13, 2024
1 parent 8e1cd3f commit e675b07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/form/FormPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<script>
const AppButton = require("../AppButton.vue");
const CommonPasswords = require('../../mixins/password/passwords.json');
const i18n = require("../../i18n/index.js");
module.exports = {
components: {
Expand Down Expand Up @@ -49,7 +50,8 @@ module.exports = {
passwordUpdate: false
}
},
mixins:[i18n],
methods: {
togglePassword() {
this.passwordIsVisible = !this.passwordIsVisible
Expand All @@ -64,14 +66,15 @@ module.exports = {
let suffix = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"][(index+1) % 10];
if (index != -1) {
this.$toast.error(`your password is the ${index+1} ${suffix} most common password!`,{ id: 'password', timeout:false });
this.$toast.error(this.translate("PASSWORD.COMMON1") + ` ${index+1}${suffix} ` + this.translate("PASSWORD.COMMON2"),{ id: 'password', timeout:false });
this.passwordUpdate = true
} else if (passwd.length < this.passwordThreshold) {
this.$toast.error(`passwords less than ${this.passwordThreshold} characters are considered unsafe.`,{ id: 'password', timeout:false });
this.translate("PASSWORD.SHORT1")
this.$toast.error(this.translate("PASSWORD.SHORT1") + ` ${this.passwordThreshold} ` + this.translate("PASSWORD.SHORT2"),{ id: 'password', timeout:false });
this.passwordUpdate = true
}else{
if (this.passwordUpdate)
this.$toast.error(`That's a better password.`,{ id: 'password', timeout:4000 });
this.$toast.error(this.translate("PASSWORD.GOOD"),{ id: 'password', timeout:4000 });
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions src/i18n/en-GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ module.exports = {
"SIGNUP.MONTH":"month",
"SIGNUP.TRYTITLE":"Want to try it first?",
"SIGNUP.TRY":"Try it for free on our",
"PASSWORD.COMMON1":"your password is the",
"PASSWORD.COMMON2":"most common password!",
"PASSWORD.SHORT1":"passwords less than",
"PASSWORD.SHORT2":"characters are considered unsafe",
"PASSWORD.GOOD":"That's a better password",
}

0 comments on commit e675b07

Please sign in to comment.