mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-25 17:10:43 +00:00
fix: コンパネからパスワードリセットした時に発生したエラーをダイアログで出す (#17513)
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
parent
2328ef3737
commit
eed6c3654f
3 changed files with 18 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
|||
### General
|
||||
- Feat: ジョブキュー管理画面からキューの一時停止/再開ができるように
|
||||
- Feat: アンテナのタイムラインから個別のノートを削除できるように
|
||||
- Fix: コンパネからrootユーザーのパスワードをリセットしようとした際にエラーが通知されない問題を修正
|
||||
- Feat: ノート検索で投稿日時の期間を条件に加えられるように(#16035)
|
||||
|
||||
### Client
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { ApiError } from '@/server/api/error.js';
|
||||
import type { UsersRepository, UserProfilesRepository, MiMeta } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
|
|
@ -18,6 +19,19 @@ export const meta = {
|
|||
requireModerator: true,
|
||||
kind: 'write:admin:reset-password',
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: 'ccafc7fe-5074-4edd-9dc0-8ef9ef6a701d',
|
||||
},
|
||||
cannotResetPasswordOfRootUser: {
|
||||
message: 'Cannot reset password of the root user.',
|
||||
code: 'CANNOT_RESET_PASSWORD_OF_ROOT_USER',
|
||||
id: 'f28fc207-42ca-44c7-a577-44b4f0ec5999',
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
|
|
@ -58,11 +72,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
||||
|
||||
if (user == null) {
|
||||
throw new Error('user not found');
|
||||
throw new ApiError(meta.errors.noSuchUser);
|
||||
}
|
||||
|
||||
if (this.serverSettings.rootUserId === user.id) {
|
||||
throw new Error('cannot reset password of root');
|
||||
throw new ApiError(meta.errors.cannotResetPasswordOfRootUser);
|
||||
}
|
||||
|
||||
const passwd = secureRndstr(8);
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ async function resetPassword() {
|
|||
if (confirm.canceled) {
|
||||
return;
|
||||
} else {
|
||||
const { password } = await misskeyApi('admin/reset-password', {
|
||||
const { password } = await os.apiWithDialog('admin/reset-password', {
|
||||
userId: user.value.id,
|
||||
});
|
||||
os.alert({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue