2018-02-21 10:25:57 -06:00
|
|
|
<template>
|
|
|
|
<div>
|
2018-11-08 12:44:35 -06:00
|
|
|
<ui-button @click="reset">{{ $t('reset') }}</ui-button>
|
2018-02-21 10:25:57 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 12:44:35 -06:00
|
|
|
import i18n from '../../../i18n';
|
2018-02-21 10:25:57 -06:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 12:44:35 -06:00
|
|
|
i18n: i18n('common/views/components/password-settings.vue'),
|
2018-02-21 10:25:57 -06:00
|
|
|
methods: {
|
|
|
|
reset() {
|
|
|
|
(this as any).apis.input({
|
2018-11-08 12:44:35 -06:00
|
|
|
title: this.$t('enter-current-password'),
|
2018-02-21 10:25:57 -06:00
|
|
|
type: 'password'
|
|
|
|
}).then(currentPassword => {
|
|
|
|
(this as any).apis.input({
|
2018-11-08 12:44:35 -06:00
|
|
|
title: this.$t('enter-new-password'),
|
2018-02-21 10:25:57 -06:00
|
|
|
type: 'password'
|
|
|
|
}).then(newPassword => {
|
|
|
|
(this as any).apis.input({
|
2018-11-08 12:44:35 -06:00
|
|
|
title: this.$t('enter-new-password-again'),
|
2018-02-21 10:25:57 -06:00
|
|
|
type: 'password'
|
|
|
|
}).then(newPassword2 => {
|
|
|
|
if (newPassword !== newPassword2) {
|
|
|
|
(this as any).apis.dialog({
|
|
|
|
title: null,
|
2018-11-08 12:44:35 -06:00
|
|
|
text: this.$t('not-match'),
|
2018-02-21 10:25:57 -06:00
|
|
|
actions: [{
|
|
|
|
text: 'OK'
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.api('i/change_password', {
|
2018-03-29 00:48:47 -05:00
|
|
|
currentPasword: currentPassword,
|
|
|
|
newPassword: newPassword
|
2018-02-21 10:25:57 -06:00
|
|
|
}).then(() => {
|
2018-11-08 12:44:35 -06:00
|
|
|
(this as any).apis.notify(this.$t('changed'));
|
2018-02-21 10:25:57 -06:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|