Files
pages/static/js/auth-remember.js
T
Anya Tokugawa b90aef79d0
Build and publish container images / images (push) Successful in 11m37s
Release container images / release (push) Successful in 22s
feat: add browser upload queue and trusted sessions with bounded projections
2026-11-08 20:27:04 +09:00

25 lines
1.0 KiB
JavaScript

(() => {
'use strict';
const choice=document.getElementById('auth-remember');
if(!choice)return;
const sync=()=>{
for(const form of document.querySelectorAll('.auth-form')){
if(form===choice.form)continue;
const path=new URL(form.action,location.href).pathname;
if(!['/_/auth/ldap','/_/auth/magic-link'].includes(path))continue;
let input=form.querySelector('input[name=remember]');
if(!input){input=document.createElement('input');input.type='hidden';input.name='remember';form.append(input);}
input.value=choice.checked?'1':'0';
}
for(const link of document.querySelectorAll('a.auth-provider-button')){
const url=new URL(link.href,location.href);
if(url.origin!==location.origin||url.pathname!=='/_/auth/oidc')continue;
if(choice.checked)url.searchParams.set('remember','1');else url.searchParams.delete('remember');
link.href=url.pathname+url.search;
}
};
choice.addEventListener('change',sync);
window.addEventListener('pageshow',sync);
sync();
})();