Fix redirect loop on login with external provider

This commit is contained in:
Krzysztof Żuraw 2023-06-06 09:42:07 +02:00 committed by GitHub
parent 5e6d12848b
commit 455602c2b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View file

@ -29,7 +29,7 @@ export interface LoginCardProps {
onSubmit?: (event: LoginFormData) => SubmitPromise; onSubmit?: (event: LoginFormData) => SubmitPromise;
} }
const LoginCard: React.FC<LoginCardProps> = props => { const LoginPage: React.FC<LoginCardProps> = props => {
const { const {
errors, errors,
disabled, disabled,
@ -179,5 +179,5 @@ const LoginCard: React.FC<LoginCardProps> = props => {
</LoginForm> </LoginForm>
); );
}; };
LoginCard.displayName = "LoginCard"; LoginPage.displayName = "LoginPage";
export default LoginCard; export default LoginPage;

View file

@ -63,15 +63,13 @@ const LoginView: React.FC<LoginViewProps> = ({ params }) => {
}; };
const handleExternalAuthentication = async (code: string, state: string) => { const handleExternalAuthentication = async (code: string, state: string) => {
const result = await loginByExternalPlugin(requestedExternalPluginId, { await loginByExternalPlugin(requestedExternalPluginId, {
code, code,
state, state,
}); });
setRequestedExternalPluginId(null); setRequestedExternalPluginId(null);
if (result && !result?.errors?.length) { navigate(fallbackUri);
navigate(fallbackUri); setFallbackUri(null);
setFallbackUri(null);
}
}; };
useEffect(() => { useEffect(() => {