35 lines
848 B
TypeScript
35 lines
848 B
TypeScript
export const DEMO_AUTH_EMAIL_COOKIE = "acve_demo_email";
|
|
export const DEMO_AUTH_ROLE_COOKIE = "acve_demo_role";
|
|
|
|
type DemoAccount = {
|
|
email: string;
|
|
password: string;
|
|
role: "teacher" | "learner";
|
|
};
|
|
|
|
const demoAccounts: DemoAccount[] = [
|
|
{
|
|
email: "teacher@acve.local",
|
|
password: "teacher123",
|
|
role: "teacher",
|
|
},
|
|
{
|
|
email: "learner@acve.local",
|
|
password: "learner123",
|
|
role: "learner",
|
|
},
|
|
];
|
|
|
|
export const demoCredentialsHint = demoAccounts
|
|
.map((account) => `${account.email} / ${account.password}`)
|
|
.join(" | ");
|
|
|
|
export const findDemoAccount = (email: string, password: string): DemoAccount | null => {
|
|
const cleanEmail = email.trim().toLowerCase();
|
|
return (
|
|
demoAccounts.find(
|
|
(account) => account.email.toLowerCase() === cleanEmail && account.password === password,
|
|
) ?? null
|
|
);
|
|
};
|