wip
This commit is contained in:
parent
0ea37056f4
commit
7b60dae1b6
|
@ -1,42 +1,4 @@
|
||||||
|
|
||||||
<mk-password-setting>
|
|
||||||
<button @click="reset" class="ui primary">%i18n:desktop.tags.mk-password-setting.reset%</button>
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
:scope
|
|
||||||
display block
|
|
||||||
color #4a535a
|
|
||||||
</style>
|
|
||||||
<script lang="typescript">
|
|
||||||
import passwordDialog from '../scripts/password-dialog';
|
|
||||||
import dialog from '../scripts/dialog';
|
|
||||||
import notify from '../scripts/notify';
|
|
||||||
|
|
||||||
this.mixin('i');
|
|
||||||
this.mixin('api');
|
|
||||||
|
|
||||||
this.reset = () => {
|
|
||||||
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-current-password%', currentPassword => {
|
|
||||||
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-new-password%', newPassword => {
|
|
||||||
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-new-password-again%', newPassword2 => {
|
|
||||||
if (newPassword !== newPassword2) {
|
|
||||||
dialog(null, '%i18n:desktop.tags.mk-password-setting.not-match%', [{
|
|
||||||
text: 'OK'
|
|
||||||
}]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.api('i/change_password', {
|
|
||||||
current_password: currentPassword,
|
|
||||||
new_password: newPassword
|
|
||||||
}).then(() => {
|
|
||||||
notify('%i18n:desktop.tags.mk-password-setting.changed%');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</mk-password-setting>
|
|
||||||
|
|
||||||
<mk-2fa-setting>
|
<mk-2fa-setting>
|
||||||
<p>%i18n:desktop.tags.mk-2fa-setting.intro%<a href="%i18n:desktop.tags.mk-2fa-setting.url%" target="_blank">%i18n:desktop.tags.mk-2fa-setting.detail%</a></p>
|
<p>%i18n:desktop.tags.mk-2fa-setting.intro%<a href="%i18n:desktop.tags.mk-2fa-setting.url%" target="_blank">%i18n:desktop.tags.mk-2fa-setting.detail%</a></p>
|
||||||
<div class="ui info warn"><p>%fa:exclamation-triangle%%i18n:desktop.tags.mk-2fa-setting.caution%</p></div>
|
<div class="ui info warn"><p>%fa:exclamation-triangle%%i18n:desktop.tags.mk-2fa-setting.caution%</p></div>
|
||||||
|
|
37
src/web/app/desktop/views/components/password-setting.vue
Normal file
37
src/web/app/desktop/views/components/password-setting.vue
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<button @click="reset" class="ui primary">%i18n:desktop.tags.mk-password-setting.reset%</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import Vue from 'vue';
|
||||||
|
import passwordDialog from '../../scripts/password-dialog';
|
||||||
|
import dialog from '../../scripts/dialog';
|
||||||
|
import notify from '../../scripts/notify';
|
||||||
|
|
||||||
|
export default Vue.extend({
|
||||||
|
methods: {
|
||||||
|
reset() {
|
||||||
|
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-current-password%', currentPassword => {
|
||||||
|
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-new-password%', newPassword => {
|
||||||
|
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-new-password-again%', newPassword2 => {
|
||||||
|
if (newPassword !== newPassword2) {
|
||||||
|
dialog(null, '%i18n:desktop.tags.mk-password-setting.not-match%', [{
|
||||||
|
text: 'OK'
|
||||||
|
}]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$root.$data.os.api('i/change_password', {
|
||||||
|
current_password: currentPassword,
|
||||||
|
new_password: newPassword
|
||||||
|
}).then(() => {
|
||||||
|
notify('%i18n:desktop.tags.mk-password-setting.changed%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Reference in a new issue