mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 10:53:08 +02:00
3963ed8ff7
* wip * tabun ok * better msg * oops * fix lint * Update gulpfile.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update src/client/scripts/set-i18n-contexts.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * refactor Co-authored-by: acid-chicken <root@acid-chicken.com> * ✨ * wip * fix lint * たぶんおk * fix flush * Translate Notification * remove console.log * fix * add notifications * remove san * wip * ok * ✌️ * Update src/prelude/array.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * wip * i18n refactor * Update init.ts * ✌️ Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
84 lines
1.7 KiB
Vue
84 lines
1.7 KiB
Vue
<template>
|
|
<section class="_card">
|
|
<div class="_title"><fa :icon="faLock"/> {{ $t('password') }}</div>
|
|
<div class="_content">
|
|
<mk-button primary @click="change()">{{ $t('changePassword') }}</mk-button>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import Vue from 'vue';
|
|
import { faLock } from '@fortawesome/free-solid-svg-icons';
|
|
import MkButton from '../../components/ui/button.vue';
|
|
|
|
export default Vue.extend({
|
|
components: {
|
|
MkButton,
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
faLock
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
async change() {
|
|
const { canceled: canceled1, result: currentPassword } = await this.$root.dialog({
|
|
title: this.$t('currentPassword'),
|
|
input: {
|
|
type: 'password'
|
|
}
|
|
});
|
|
if (canceled1) return;
|
|
|
|
const { canceled: canceled2, result: newPassword } = await this.$root.dialog({
|
|
title: this.$t('newPassword'),
|
|
input: {
|
|
type: 'password'
|
|
}
|
|
});
|
|
if (canceled2) return;
|
|
|
|
const { canceled: canceled3, result: newPassword2 } = await this.$root.dialog({
|
|
title: this.$t('newPasswordRetype'),
|
|
input: {
|
|
type: 'password'
|
|
}
|
|
});
|
|
if (canceled3) return;
|
|
|
|
if (newPassword !== newPassword2) {
|
|
this.$root.dialog({
|
|
type: 'error',
|
|
text: this.$t('retypedNotMatch')
|
|
});
|
|
return;
|
|
}
|
|
|
|
const dialog = this.$root.dialog({
|
|
type: 'waiting',
|
|
iconOnly: true
|
|
});
|
|
|
|
this.$root.api('i/change-password', {
|
|
currentPassword,
|
|
newPassword
|
|
}).then(() => {
|
|
this.$root.dialog({
|
|
type: 'success',
|
|
iconOnly: true, autoClose: true
|
|
});
|
|
}).catch(e => {
|
|
this.$root.dialog({
|
|
type: 'error',
|
|
text: e
|
|
});
|
|
}).finally(() => {
|
|
dialog.close();
|
|
});
|
|
}
|
|
}
|
|
});
|
|
</script>
|