mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-10-05 01:09:04 +02:00
feat: add qr code alternative sign in method (#1594)
Co-authored-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
co-authored by
ItalyPaleAle
parent
968f97fa61
commit
e1fd1d320f
@@ -38,24 +38,13 @@
|
||||
});
|
||||
|
||||
const isDesktop = new MediaQuery('(min-width: 1024px)');
|
||||
let alternativeSignInButton = $state({
|
||||
href: '/login/alternative',
|
||||
let alternativeSignInButton = $derived({
|
||||
href:
|
||||
page.url.pathname === '/login'
|
||||
? `/login/alternative${page.url.search}`
|
||||
: `/login/alternative?redirect=${encodeURIComponent(page.url.pathname + page.url.search)}`,
|
||||
label: m.alternative_sign_in_methods()
|
||||
});
|
||||
|
||||
appConfigStore.subscribe((config) => {
|
||||
if (config.emailOneTimeAccessAsUnauthenticatedEnabled) {
|
||||
alternativeSignInButton.href = '/login/alternative';
|
||||
alternativeSignInButton.label = m.alternative_sign_in_methods();
|
||||
} else {
|
||||
alternativeSignInButton.href = '/login/alternative/code';
|
||||
alternativeSignInButton.label = m.sign_in_with_login_code();
|
||||
}
|
||||
|
||||
if (page.url.pathname != '/login') {
|
||||
alternativeSignInButton.href = `${alternativeSignInButton.href}?redirect=${encodeURIComponent(page.url.pathname + page.url.search)}`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if backgroundImageExists === undefined}
|
||||
|
||||
@@ -32,9 +32,14 @@
|
||||
}
|
||||
};
|
||||
|
||||
QRCode.toCanvas(canvasEl, value, options).catch((error: Error) => {
|
||||
console.error('Error generating QR Code:', error);
|
||||
});
|
||||
QRCode.toCanvas(canvasEl, value, options)
|
||||
.then(() => {
|
||||
canvasEl?.style.removeProperty('height');
|
||||
canvasEl?.style.removeProperty('width');
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
console.error('Error generating QR Code:', error);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user