Login:OAuth: fix login without auth cookie
This commit is contained in:
parent
fb3a0c51af
commit
9c986d3bc7
@ -59,6 +59,8 @@ import ForgotContainer from "./sub-components/ForgotContainer";
|
||||
import { StyledCaptcha } from "./LoginForm.styled";
|
||||
import { LoginDispatchContext, LoginValueContext } from "../Login";
|
||||
import OAuthClientInfo from "../ConsentInfo";
|
||||
import api from "@docspace/shared/api";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
const LoginForm = ({
|
||||
hashSettings,
|
||||
@ -71,6 +73,7 @@ const LoginForm = ({
|
||||
const { setIsLoading } = useContext(LoginDispatchContext);
|
||||
|
||||
const searchParams = useSearchParams();
|
||||
const router = useRouter();
|
||||
|
||||
const theme = useTheme();
|
||||
|
||||
@ -236,7 +239,15 @@ const LoginForm = ({
|
||||
const session = !isChecked;
|
||||
|
||||
login(user, hash, session, captchaToken)
|
||||
.then((res: string | object) => {
|
||||
.then(async (res: string | object) => {
|
||||
if (clientId) {
|
||||
await api.oauth.onOAuthLogin(clientId);
|
||||
|
||||
router.push(`/login/consent?clientId=${clientId}`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const isConfirm = typeof res === "string" && res.includes("confirm");
|
||||
const redirectPath =
|
||||
referenceUrl || sessionStorage.getItem("referenceUrl");
|
||||
@ -275,16 +286,17 @@ const LoginForm = ({
|
||||
setIsLoading(false);
|
||||
});
|
||||
}, [
|
||||
hashSettings,
|
||||
identifier,
|
||||
identifierValid,
|
||||
isCaptcha,
|
||||
isCaptchaSuccessful,
|
||||
isChecked,
|
||||
isDesktop,
|
||||
password,
|
||||
reCaptchaPublicKey,
|
||||
isCaptcha,
|
||||
identifier,
|
||||
password,
|
||||
identifierValid,
|
||||
setIsLoading,
|
||||
hashSettings,
|
||||
isDesktop,
|
||||
isChecked,
|
||||
isCaptchaSuccessful,
|
||||
clientId,
|
||||
referenceUrl,
|
||||
]);
|
||||
|
||||
@ -337,8 +349,6 @@ const LoginForm = ({
|
||||
|
||||
const passwordErrorMessage = errorMessage();
|
||||
|
||||
console.log(client);
|
||||
|
||||
return (
|
||||
<form className="auth-form-container">
|
||||
{client && (
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"date": "2024529_112928",
|
||||
"date": "2024530_114536",
|
||||
"checksums": {
|
||||
"api.js": "0efbae3383bf6c6b6f26d573eee164d2",
|
||||
"api.poly.js": "2a2ac2c0e4a7007b61d2d1ff7b00a22e",
|
||||
|
@ -130,7 +130,7 @@ export const onOAuthLogin = (clientId: string) => {
|
||||
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/oauth2/login?clientId=${clientId}`,
|
||||
url: `/oauth2/login?client_id=${clientId}`,
|
||||
data: formData,
|
||||
withRedirect: true,
|
||||
headers: {
|
||||
|
Loading…
Reference in New Issue
Block a user