fix: bypass local login #878

This commit is contained in:
diced
2025-09-06 12:51:46 -07:00
parent 40c12ca3f0
commit 3240e19710

View File

@@ -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]);