core: move tfa check to a seperate route

This commit is contained in:
undefined committed 2024-10-23 19:04:05 +08:00
1 parent c76ada120b
commit e545bceefb
3 files changed
+15 -14

No files matched your search

+3 -11
View File
@@ -74,19 +74,11 @@ export default new AutoloadPage('user_verify', () => {
ev.preventDefault();
const form = ev.currentTarget.form;
const uname = $(form).find('[name="uname"]').val() as string;
const info = await api(gql`
uname: user(uname:${uname}){
tfa authn
}
mail: user(mail:${uname}){
tfa authn
}
`, ['data']);
if (!info.uname && !info.mail) {
Notification.error(i18n('User not found.'));
if (!uname) {
form.elements.namedItem('uname')?.focus();
return;
}
const { authn, tfa } = info.uname || info.mail;
const { authn, tfa } = await request.get('/user/tfa', { q: uname });
if (authn || tfa) {
const handleKeyDown = (event) => {
if (event.key === 'Enter') {