feat: メールアドレスを使用してユーザー名を割り出す機能

Resolve #10158
This commit is contained in:
syuilo 2023-11-14 07:58:18 +09:00
parent a059dbe41b
commit 2d2eefe3d4
6 changed files with 102 additions and 6 deletions

View file

@ -39,3 +39,26 @@ export async function lookupUser() {
notFound();
});
}
export async function lookupUserByEmail() {
const { canceled, result } = await os.inputText({
title: i18n.ts.emailAddress,
type: 'email',
});
if (canceled) return;
try {
const user = await os.apiWithDialog('admin/accounts/find-by-email', { email: result });
os.pageWindow(`/admin/user/${user.id}`);
} catch (err) {
if (err.code === 'USER_NOT_FOUND') {
os.alert({
type: 'error',
text: i18n.ts.noSuchUser,
});
} else {
throw err;
}
}
}