mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 13:05:25 +02:00
Allow any email to register and fix logout blank page bug
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ export default function App() {
|
|||||||
|
|
||||||
const handleSignOut = () => {
|
const handleSignOut = () => {
|
||||||
signOut();
|
signOut();
|
||||||
setSession(null);
|
window.location.href = '/';
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export function LoginPage({ onLogin }: LoginPageProps) {
|
|||||||
type="email"
|
type="email"
|
||||||
value={email}
|
value={email}
|
||||||
onChange={e => setEmail(e.target.value)}
|
onChange={e => setEmail(e.target.value)}
|
||||||
placeholder="you@craze-group.com"
|
placeholder="you@example.com"
|
||||||
required
|
required
|
||||||
autoFocus
|
autoFocus
|
||||||
className="w-full bg-slate-900 border border-slate-700 rounded-md px-3 py-2.5 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-colors"
|
className="w-full bg-slate-900 border border-slate-700 rounded-md px-3 py-2.5 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-colors"
|
||||||
@@ -157,7 +157,7 @@ export function LoginPage({ onLogin }: LoginPageProps) {
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p className="text-center text-slate-600 text-xs mt-6">
|
<p className="text-center text-slate-600 text-xs mt-6">
|
||||||
Access restricted to @craze-group.com accounts
|
Create an account to get started
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const SUPABASE_URL = 'https://hwithddwaapyhnfwcesj.supabase.co';
|
const SUPABASE_URL = 'https://hwithddwaapyhnfwcesj.supabase.co';
|
||||||
const SUPABASE_ANON_KEY = 'sb_publishable_fGXkh0bSrAOqSk2jWKAzSg_NJD9YPCv';
|
const SUPABASE_ANON_KEY = 'sb_publishable_fGXkh0bSrAOqSk2jWKAzSg_NJD9YPCv';
|
||||||
const ALLOWED_DOMAIN = '@craze-group.com';
|
|
||||||
const SESSION_KEY = 'craze_auth_session';
|
const SESSION_KEY = 'craze_auth_session';
|
||||||
|
|
||||||
export interface AuthSession {
|
export interface AuthSession {
|
||||||
@@ -9,10 +8,6 @@ export interface AuthSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function signUp(email: string, password: string): Promise<void> {
|
export async function signUp(email: string, password: string): Promise<void> {
|
||||||
if (!email.toLowerCase().endsWith(ALLOWED_DOMAIN)) {
|
|
||||||
throw new Error(`Only ${ALLOWED_DOMAIN} email addresses are allowed.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await fetch(`${SUPABASE_URL}/auth/v1/signup`, {
|
const response = await fetch(`${SUPABASE_URL}/auth/v1/signup`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -29,10 +24,6 @@ export async function signUp(email: string, password: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function signIn(email: string, password: string): Promise<AuthSession> {
|
export async function signIn(email: string, password: string): Promise<AuthSession> {
|
||||||
if (!email.toLowerCase().endsWith(ALLOWED_DOMAIN)) {
|
|
||||||
throw new Error(`Only ${ALLOWED_DOMAIN} email addresses are allowed.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await fetch(`${SUPABASE_URL}/auth/v1/token?grant_type=password`, {
|
const response = await fetch(`${SUPABASE_URL}/auth/v1/token?grant_type=password`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user