Fix password reset
This commit is contained in:
parent
99b5d94b11
commit
635afdf53f
2 changed files with 7 additions and 14 deletions
|
@ -336,6 +336,8 @@ registerSecurityKey: "セキュリティキーを登録する"
|
|||
lastUsed: "最後の使用"
|
||||
unregister: "登録を解除"
|
||||
passwordLessLogin: "パスワード無しログイン"
|
||||
resetPassword: "パスワードをリセット"
|
||||
newPasswordIs: "新しいパスワードは「{password}」です"
|
||||
|
||||
_2fa:
|
||||
registerDevice: "デバイスを登録"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<x-window @closed="() => { $emit('closed'); destroyDom(); }" :avatar="user">
|
||||
<template #header><mk-user-name :user="user"/></template>
|
||||
<div class="vrcsvlkm">
|
||||
<mk-button @click="changePassword()">{{ $t('changePassword') }}</mk-button>
|
||||
<mk-button @click="resetPassword()" primary>{{ $t('resetPassword') }}</mk-button>
|
||||
<mk-switch v-if="$store.state.i.isAdmin" @change="toggleModerator()" v-model="moderator">{{ $t('moderator') }}</mk-switch>
|
||||
<mk-switch @change="toggleSilence()" v-model="silenced">{{ $t('silence') }}</mk-switch>
|
||||
<mk-switch @change="toggleSuspend()" v-model="suspended">{{ $t('suspend') }}</mk-switch>
|
||||
|
@ -42,27 +42,18 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
methods: {
|
||||
async changePassword() {
|
||||
const { canceled: canceled, result: newPassword } = await this.$root.dialog({
|
||||
title: this.$t('newPassword'),
|
||||
input: {
|
||||
type: 'password'
|
||||
}
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
async resetPassword() {
|
||||
const dialog = this.$root.dialog({
|
||||
type: 'waiting',
|
||||
iconOnly: true
|
||||
});
|
||||
|
||||
this.$root.api('admin/change-password', {
|
||||
this.$root.api('admin/reset-password', {
|
||||
userId: this.user.id,
|
||||
newPassword
|
||||
}).then(() => {
|
||||
}).then(({ password }) => {
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
iconOnly: true, autoClose: true
|
||||
text: this.$t('newPasswordIs', { password })
|
||||
});
|
||||
}).catch(e => {
|
||||
this.$root.dialog({
|
||||
|
|
Loading…
Reference in a new issue