mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 12:35:25 +02:00
Allow oriol.rodrigo@craze-group.com login and restrict to dashboard
This commit is contained in:
@@ -25,6 +25,17 @@ export async function signUp(email: string, password: string): Promise<void> {
|
||||
}
|
||||
|
||||
export async function signIn(email: string, password: string): Promise<AuthSession> {
|
||||
if (email.trim().toLowerCase() === 'oriol.rodrigo@craze-group.com' && password === '@Craze2026') {
|
||||
const session: AuthSession = {
|
||||
access_token: 'mock-access-token-oriol',
|
||||
refresh_token: 'mock-refresh-token-oriol',
|
||||
user: { id: 'mock-id-oriol', email: 'oriol.rodrigo@craze-group.com' },
|
||||
};
|
||||
localStorage.setItem(SESSION_KEY, JSON.stringify(session));
|
||||
window.dispatchEvent(new Event('session-refreshed'));
|
||||
return session;
|
||||
}
|
||||
|
||||
const response = await fetch(`${SUPABASE_URL}/auth/v1/token?grant_type=password`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -79,6 +90,17 @@ export async function signIn(email: string, password: string): Promise<AuthSessi
|
||||
let activeRefreshPromise: Promise<AuthSession> | null = null;
|
||||
|
||||
export async function refreshSession(refreshToken: string): Promise<AuthSession> {
|
||||
if (refreshToken === 'mock-refresh-token-oriol') {
|
||||
const session: AuthSession = {
|
||||
access_token: 'mock-access-token-oriol',
|
||||
refresh_token: 'mock-refresh-token-oriol',
|
||||
user: { id: 'mock-id-oriol', email: 'oriol.rodrigo@craze-group.com' },
|
||||
};
|
||||
localStorage.setItem(SESSION_KEY, JSON.stringify(session));
|
||||
window.dispatchEvent(new Event('session-refreshed'));
|
||||
return session;
|
||||
}
|
||||
|
||||
if (activeRefreshPromise) {
|
||||
return activeRefreshPromise;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user