diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 512a72b3e..3b1ed879e 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -336,6 +336,8 @@ registerSecurityKey: "セキュリティキーを登録する" lastUsed: "最後の使用" unregister: "登録を解除" passwordLessLogin: "パスワード無しログイン" +resetPassword: "パスワードをリセット" +newPasswordIs: "新しいパスワードは「{password}」です" _2fa: registerDevice: "デバイスを登録" diff --git a/src/client/components/user-moderate-dialog.vue b/src/client/components/user-moderate-dialog.vue index 46915b2e9..f45342564 100644 --- a/src/client/components/user-moderate-dialog.vue +++ b/src/client/components/user-moderate-dialog.vue @@ -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({