mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-27 16:08:47 -07:00
fix(auth): encrypt stored cookie keys; tighten the link and sign-out flows
- Data-protection keys are encrypted (AES-256-GCM, key derived from the server secret) before they reach the DataProtectionKeys table. - /link only follows local return paths and keeps the form when a signed-in visitor has an identity waiting to be linked. - A failed sign-out says so instead of reloading as if it worked.
This commit is contained in:
@@ -19,6 +19,13 @@ export function getMe(fresh = false): Promise<AccountMe> {
|
||||
return cached;
|
||||
}
|
||||
|
||||
/** `url` if it is a path on this site, else `/` (the server applies the same
|
||||
* rule): never navigate to an address taken from the query string otherwise. */
|
||||
export function localPath(url: string | null | undefined): string {
|
||||
if (!url || !url.startsWith('/') || url.startsWith('//') || url.startsWith('/\\')) return '/';
|
||||
return url;
|
||||
}
|
||||
|
||||
/** Starts sign-in at the provider; comes back to `returnUrl` on this site. */
|
||||
export function signInUrl(returnUrl = window.location.pathname + window.location.search): string {
|
||||
return `/api/auth/external/login?returnUrl=${encodeURIComponent(returnUrl)}`;
|
||||
|
||||
Reference in New Issue
Block a user