ui: fix signin dialog

pull/532/head^2
undefined 2 years ago
parent ba7f4b396f
commit 73d5726493
No known key found for this signature in database

@ -1,8 +0,0 @@
const { writeFileSync } = require('fs');
const argv = require('cac')().parse();
const pkg = require('../package.json');
if (argv.options.dev) pkg.version = `${pkg.version}-dev`;
else pkg.version = pkg.version.replace('-dev', '');
writeFileSync(`${process.cwd()}/package.json`, JSON.stringify(pkg, null, 2));

@ -42,7 +42,7 @@ const signinDialogPage = new AutoloadPage('signinDialogPage', null, () => {
$('[data-lostpass]').on('click', (e) => { $('[data-lostpass]').on('click', (e) => {
e.preventDefault(); e.preventDefault();
new InfoDialog({ new InfoDialog({
$body: tpl`<p>${i18n('Relax and try to remember your password.')}</p>`, $body: tpl.typoMsg(i18n('Relax and try to remember your password.')),
}).open(); }).open();
}); });
}); });

@ -72,8 +72,8 @@ async function chooseAction(authn?: boolean) {
export default new AutoloadPage('user_verify', () => { export default new AutoloadPage('user_verify', () => {
$(document).on('click', '[name="login_submit"]', async (ev) => { $(document).on('click', '[name="login_submit"]', async (ev) => {
ev.preventDefault(); ev.preventDefault();
const $form = ev.currentTarget.form; const form = ev.currentTarget.form;
const uname = $('[name="uname"]').val() as string; const uname = $(form).find('[name="uname"]').val() as string;
const info = await api(gql` const info = await api(gql`
uname: user(uname:${uname}){ uname: user(uname:${uname}){
tfa authn tfa authn
@ -88,13 +88,13 @@ export default new AutoloadPage('user_verify', () => {
let action = (authn && tfa) ? await chooseAction(true) : ''; let action = (authn && tfa) ? await chooseAction(true) : '';
action ||= tfa ? await chooseAction(false) : 'webauthn'; action ||= tfa ? await chooseAction(false) : 'webauthn';
if (action === 'webauthn') { if (action === 'webauthn') {
const challenge = await verifywebauthn($form); const challenge = await verifywebauthn(form);
if (challenge) $form['authnChallenge'].value = challenge; if (challenge) form['authnChallenge'].value = challenge;
else return; else return;
} else if (action === 'tfa') $form['tfa'].value = $('[name="tfa_code"]').val() as string; } else if (action === 'tfa') form['tfa'].value = $('[name="tfa_code"]').val() as string;
else return; else return;
} }
$form.submit(); form.submit();
}); });
$(document).on('click', '[name=webauthn_verify]', async (ev) => { $(document).on('click', '[name=webauthn_verify]', async (ev) => {
ev.preventDefault(); ev.preventDefault();

Loading…
Cancel
Save