Login:OAuth2: fix deny
This commit is contained in:
parent
1f6679f29a
commit
50bcf1d577
@ -28,7 +28,7 @@ export const getClient = async (
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...client,
|
...client,
|
||||||
websiteUrl: client.website_url,
|
websiteUrl: client?.website_url || "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +164,20 @@ export const onOAuthSubmit = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const onOAuthCancel = (clientId: string, clientState: string) => {
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
|
formData.append("client_id", clientId);
|
||||||
|
formData.append("state", clientState);
|
||||||
|
|
||||||
|
return request({
|
||||||
|
method: "post",
|
||||||
|
url: `/oauth2/authorize`,
|
||||||
|
data: formData,
|
||||||
|
withRedirect: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const getConsentList = async (): Promise<IClientProps[]> => {
|
export const getConsentList = async (): Promise<IClientProps[]> => {
|
||||||
const clients: any = await request({
|
const clients: any = await request({
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -240,8 +240,6 @@ const Login: React.FC<ILoginProps> = ({
|
|||||||
if (!mounted) return <></>;
|
if (!mounted) return <></>;
|
||||||
if (isRestoringPortal) return <></>;
|
if (isRestoringPortal) return <></>;
|
||||||
|
|
||||||
console.log(portalSettings);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoginFormWrapper
|
<LoginFormWrapper
|
||||||
id="login-page"
|
id="login-page"
|
||||||
|
@ -103,16 +103,34 @@ const Consent = ({
|
|||||||
clientState = c.replace("client_state=", "").trim();
|
clientState = c.replace("client_state=", "").trim();
|
||||||
});
|
});
|
||||||
|
|
||||||
deleteCookie("client_id");
|
console.log(clientState);
|
||||||
deleteCookie("client_state");
|
|
||||||
|
// deleteCookie("client_id");
|
||||||
|
// deleteCookie("client_state");
|
||||||
|
|
||||||
await api.oauth.onOAuthSubmit(clientId, clientState, scope);
|
await api.oauth.onOAuthSubmit(clientId, clientState, scope);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDenyClick = () => {
|
const onDenyClick = async () => {
|
||||||
|
const clientId = oauth.clientId;
|
||||||
|
|
||||||
|
let clientState = "";
|
||||||
|
|
||||||
|
setCookie("client_id", clientId);
|
||||||
|
|
||||||
|
await api.oauth.onOAuthLogin();
|
||||||
|
|
||||||
|
const cookie = document.cookie.split(";");
|
||||||
|
|
||||||
|
cookie.forEach((c) => {
|
||||||
|
if (c.includes("client_state"))
|
||||||
|
clientState = c.replace("client_state=", "").trim();
|
||||||
|
});
|
||||||
|
|
||||||
deleteCookie("client_id");
|
deleteCookie("client_id");
|
||||||
deleteCookie("client_state");
|
deleteCookie("client_state");
|
||||||
window.location.href = oauth.client.websiteUrl;
|
|
||||||
|
await api.oauth.onOAuthCancel(clientId, clientState);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChangeUserClick = async () => {
|
const onChangeUserClick = async () => {
|
||||||
|
@ -221,7 +221,6 @@ const LoginForm: React.FC<ILoginFormProps> = ({
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
console.log(pass, hashSettings);
|
|
||||||
const hash = createPasswordHash(pass, hashSettings);
|
const hash = createPasswordHash(pass, hashSettings);
|
||||||
|
|
||||||
isDesktop && checkPwd();
|
isDesktop && checkPwd();
|
||||||
|
Loading…
Reference in New Issue
Block a user