mirror of
https://github.com/diced/zipline.git
synced 2025-12-05 20:40:12 -08:00
fix: bypass local login #878
This commit is contained in:
@@ -32,7 +32,7 @@ import {
|
|||||||
IconX,
|
IconX,
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Link, redirect, useLocation, useNavigate } from 'react-router-dom';
|
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
import GenericError from '../../error/GenericError';
|
import GenericError from '../../error/GenericError';
|
||||||
import { useTitle } from '@/lib/hooks/useTitle';
|
import { useTitle } from '@/lib/hooks/useTitle';
|
||||||
@@ -157,13 +157,14 @@ export default function Login() {
|
|||||||
}, [user]);
|
}, [user]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log({ willRedirect, config });
|
||||||
if (willRedirect && config) {
|
if (willRedirect && config) {
|
||||||
const provider = Object.keys(config.oauthEnabled).find(
|
const provider = Object.keys(config.oauthEnabled).find(
|
||||||
(x) => config.oauthEnabled[x as keyof typeof config.oauthEnabled] === true,
|
(x) => config.oauthEnabled[x as keyof typeof config.oauthEnabled] === true,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (provider) {
|
if (provider) {
|
||||||
redirect(`/api/auth/oauth/${provider.toLowerCase()}`);
|
window.location.href = `/api/auth/oauth/${provider.toLowerCase()}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [willRedirect, config]);
|
}, [willRedirect, config]);
|
||||||
|
|||||||
Reference in New Issue
Block a user