redesign login/registration. add autologin from registration. add 'continue' register from accept acc

This commit is contained in:
aurinex
2025-12-21 01:15:53 +05:00
parent 779f8f779d
commit 4b8e535c58
7 changed files with 1522 additions and 566 deletions

View File

@ -0,0 +1,43 @@
export type PendingVerification = {
username: string;
password?: string;
createdAt: number;
};
const PENDING_KEY = 'pending_verifications_v1';
export const loadPending = (): PendingVerification[] => {
try {
const raw = localStorage.getItem(PENDING_KEY);
return raw ? (JSON.parse(raw) as PendingVerification[]) : [];
} catch {
return [];
}
};
const savePending = (items: PendingVerification[]) => {
localStorage.setItem(PENDING_KEY, JSON.stringify(items));
};
export const upsertPending = (item: PendingVerification) => {
const list = loadPending();
const next = [
item,
...list.filter(
(x) => x.username.toLowerCase() !== item.username.toLowerCase(),
),
].slice(0, 5);
savePending(next);
};
export const removePending = (username: string) => {
const list = loadPending();
savePending(
list.filter((x) => x.username.toLowerCase() !== username.toLowerCase()),
);
};
export const clearPending = () => {
localStorage.removeItem(PENDING_KEY);
};