Improve input dialog
This commit is contained in:
@ -11,34 +11,43 @@ import i18n from '../../../i18n';
|
||||
export default Vue.extend({
|
||||
i18n: i18n('common/views/components/password-settings.vue'),
|
||||
methods: {
|
||||
reset() {
|
||||
this.$input({
|
||||
async reset() {
|
||||
const { canceled: canceled1, result: currentPassword } = await this.$root.dialog({
|
||||
title: this.$t('enter-current-password'),
|
||||
type: 'password'
|
||||
}).then(currentPassword => {
|
||||
this.$input({
|
||||
title: this.$t('enter-new-password'),
|
||||
input: {
|
||||
type: 'password'
|
||||
}).then(newPassword => {
|
||||
this.$input({
|
||||
title: this.$t('enter-new-password-again'),
|
||||
type: 'password'
|
||||
}).then(newPassword2 => {
|
||||
if (newPassword !== newPassword2) {
|
||||
this.$root.dialog({
|
||||
title: null,
|
||||
text: this.$t('not-match')
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$root.api('i/change_password', {
|
||||
currentPasword: currentPassword,
|
||||
newPassword: newPassword
|
||||
}).then(() => {
|
||||
this.$notify(this.$t('changed'));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
if (canceled1) return;
|
||||
|
||||
const { canceled: canceled2, result: newPassword } = await this.$root.dialog({
|
||||
title: this.$t('enter-new-password'),
|
||||
input: {
|
||||
type: 'password'
|
||||
}
|
||||
});
|
||||
if (canceled2) return;
|
||||
|
||||
const { canceled: canceled3, result: newPassword2 } = await this.$root.dialog({
|
||||
title: this.$t('enter-new-password-again'),
|
||||
input: {
|
||||
type: 'password'
|
||||
}
|
||||
});
|
||||
if (canceled3) return;
|
||||
|
||||
if (newPassword !== newPassword2) {
|
||||
this.$root.dialog({
|
||||
title: null,
|
||||
text: this.$t('not-match')
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$root.api('i/change_password', {
|
||||
currentPasword: currentPassword,
|
||||
newPassword: newPassword
|
||||
}).then(() => {
|
||||
this.$notify(this.$t('changed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user