mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-30 18:13:46 +00:00
feat: Improved password security policy (#2345)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -21,12 +21,10 @@ export default {
|
||||
methods: {
|
||||
async confirmToken() {
|
||||
try {
|
||||
const {
|
||||
data: { redirect_url: redirectURL },
|
||||
} = await Auth.verifyPasswordToken({
|
||||
await Auth.verifyPasswordToken({
|
||||
confirmationToken: this.confirmationToken,
|
||||
});
|
||||
window.location = redirectURL;
|
||||
window.location = DEFAULT_REDIRECT_URL;
|
||||
} catch (error) {
|
||||
window.location = DEFAULT_REDIRECT_URL;
|
||||
}
|
||||
|
||||
@@ -120,8 +120,12 @@ export default {
|
||||
window.location = DEFAULT_REDIRECT_URL;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.showAlert(this.$t('SET_NEW_PASSWORD.API.ERROR_MESSAGE'));
|
||||
.catch(error => {
|
||||
let errorMessage = this.$t('SET_NEW_PASSWORD.API.ERROR_MESSAGE');
|
||||
if (error?.data?.message) {
|
||||
errorMessage = error.data.message;
|
||||
}
|
||||
this.showAlert(errorMessage);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -25,6 +25,17 @@
|
||||
"
|
||||
@blur="$v.credentials.fullName.$touch"
|
||||
/>
|
||||
<woot-input
|
||||
v-model.trim="credentials.email"
|
||||
type="email"
|
||||
:class="{ error: $v.credentials.email.$error }"
|
||||
:label="$t('REGISTER.EMAIL.LABEL')"
|
||||
:placeholder="$t('REGISTER.EMAIL.PLACEHOLDER')"
|
||||
:error="
|
||||
$v.credentials.email.$error ? $t('REGISTER.EMAIL.ERROR') : ''
|
||||
"
|
||||
@blur="$v.credentials.email.$touch"
|
||||
/>
|
||||
<woot-input
|
||||
v-model="credentials.accountName"
|
||||
:class="{ error: $v.credentials.accountName.$error }"
|
||||
@@ -38,15 +49,31 @@
|
||||
@blur="$v.credentials.accountName.$touch"
|
||||
/>
|
||||
<woot-input
|
||||
v-model.trim="credentials.email"
|
||||
type="email"
|
||||
:class="{ error: $v.credentials.email.$error }"
|
||||
:label="$t('REGISTER.EMAIL.LABEL')"
|
||||
:placeholder="$t('REGISTER.EMAIL.PLACEHOLDER')"
|
||||
v-model.trim="credentials.password"
|
||||
type="password"
|
||||
:class="{ error: $v.credentials.password.$error }"
|
||||
:label="$t('LOGIN.PASSWORD.LABEL')"
|
||||
:placeholder="$t('SET_NEW_PASSWORD.PASSWORD.PLACEHOLDER')"
|
||||
:error="
|
||||
$v.credentials.email.$error ? $t('REGISTER.EMAIL.ERROR') : ''
|
||||
$v.credentials.password.$error
|
||||
? $t('SET_NEW_PASSWORD.PASSWORD.ERROR')
|
||||
: ''
|
||||
"
|
||||
@blur="$v.credentials.email.$touch"
|
||||
@blur="$v.credentials.password.$touch"
|
||||
/>
|
||||
|
||||
<woot-input
|
||||
v-model.trim="credentials.confirmPassword"
|
||||
type="password"
|
||||
:class="{ error: $v.credentials.confirmPassword.$error }"
|
||||
:label="$t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.LABEL')"
|
||||
:placeholder="$t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.PLACEHOLDER')"
|
||||
:error="
|
||||
$v.credentials.confirmPassword.$error
|
||||
? $t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.ERROR')
|
||||
: ''
|
||||
"
|
||||
@blur="$v.credentials.confirmPassword.$touch"
|
||||
/>
|
||||
<woot-submit-button
|
||||
:disabled="isSignupInProgress"
|
||||
@@ -89,6 +116,8 @@ export default {
|
||||
accountName: '',
|
||||
fullName: '',
|
||||
email: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
},
|
||||
isSignupInProgress: false,
|
||||
error: '',
|
||||
@@ -108,6 +137,19 @@ export default {
|
||||
required,
|
||||
email,
|
||||
},
|
||||
password: {
|
||||
required,
|
||||
minLength: minLength(6),
|
||||
},
|
||||
confirmPassword: {
|
||||
required,
|
||||
isEqPassword(value) {
|
||||
if (value !== this.credentials.password) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
||||
Reference in New Issue
Block a user