2018-02-22 01:25:57 +09:00
|
|
|
<template>
|
|
|
|
<div>
|
2018-11-09 03:44:35 +09:00
|
|
|
<ui-button @click="reset">{{ $t('reset') }}</ui-button>
|
2018-02-22 01:25:57 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-09 03:44:35 +09:00
|
|
|
import i18n from '../../../i18n';
|
2018-02-22 01:25:57 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-09 03:44:35 +09:00
|
|
|
i18n: i18n('common/views/components/password-settings.vue'),
|
2018-02-22 01:25:57 +09:00
|
|
|
methods: {
|
|
|
|
reset() {
|
2018-11-09 16:00:29 +09:00
|
|
|
this.$input({
|
2018-11-09 03:44:35 +09:00
|
|
|
title: this.$t('enter-current-password'),
|
2018-02-22 01:25:57 +09:00
|
|
|
type: 'password'
|
|
|
|
}).then(currentPassword => {
|
2018-11-09 16:00:29 +09:00
|
|
|
this.$input({
|
2018-11-09 03:44:35 +09:00
|
|
|
title: this.$t('enter-new-password'),
|
2018-02-22 01:25:57 +09:00
|
|
|
type: 'password'
|
|
|
|
}).then(newPassword => {
|
2018-11-09 16:00:29 +09:00
|
|
|
this.$input({
|
2018-11-09 03:44:35 +09:00
|
|
|
title: this.$t('enter-new-password-again'),
|
2018-02-22 01:25:57 +09:00
|
|
|
type: 'password'
|
|
|
|
}).then(newPassword2 => {
|
|
|
|
if (newPassword !== newPassword2) {
|
2018-11-14 16:30:58 +09:00
|
|
|
this.$root.alert({
|
2018-02-22 01:25:57 +09:00
|
|
|
title: null,
|
2018-11-14 16:30:58 +09:00
|
|
|
text: this.$t('not-match')
|
2018-02-22 01:25:57 +09:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('i/change_password', {
|
2018-03-29 14:48:47 +09:00
|
|
|
currentPasword: currentPassword,
|
|
|
|
newPassword: newPassword
|
2018-02-22 01:25:57 +09:00
|
|
|
}).then(() => {
|
2018-11-09 16:00:29 +09:00
|
|
|
this.$notify(this.$t('changed'));
|
2018-02-22 01:25:57 +09:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|