mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
Compare commits
3 Commits
3674a28dee
...
c4fa91f6ea
Author | SHA1 | Date | |
---|---|---|---|
|
c4fa91f6ea | ||
|
69502b22a9 | ||
|
356946e635 |
@ -64,14 +64,19 @@ export const connectPortalAtom = atom(
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err instanceof AbnormalPortalConfigError) {
|
if (!(err instanceof AbnormalPortalConfigError)) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
`Got abnormal portal config: ${err.message}, retrying...`
|
`Got abnormal portal config: ${err.message}, retrying...`
|
||||||
);
|
);
|
||||||
|
set(statusAtom, "prelogin");
|
||||||
prelogin = await portalService.prelogin(portal);
|
prelogin = await portalService.prelogin(portal);
|
||||||
continue;
|
const isProcessing = get(isProcessingAtom);
|
||||||
} else {
|
if (!isProcessing) {
|
||||||
throw err;
|
logger.info("Operation cancelled");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { atom } from "jotai";
|
import { atom } from "jotai";
|
||||||
import gatewayService from "../services/gatewayService";
|
import gatewayService from "../services/gatewayService";
|
||||||
import logger from "../utils/logger";
|
import logger from "../utils/logger";
|
||||||
|
import { redact } from "../utils/redact";
|
||||||
import { isProcessingAtom, statusAtom } from "./status";
|
import { isProcessingAtom, statusAtom } from "./status";
|
||||||
import { connectVpnAtom } from "./vpn";
|
import { connectVpnAtom } from "./vpn";
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ export const loginGatewayAtom = atom(
|
|||||||
set(statusAtom, "gateway-login");
|
set(statusAtom, "gateway-login");
|
||||||
let token: string;
|
let token: string;
|
||||||
try {
|
try {
|
||||||
logger.info(`Logging in to gateway ${gateway}...`);
|
logger.info(`Logging in to gateway ${redact(gateway)}...`);
|
||||||
token = await gatewayService.login(gateway, credential);
|
token = await gatewayService.login(gateway, credential);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error("Failed to login to gateway");
|
throw new Error("Failed to login to gateway");
|
||||||
|
@ -80,6 +80,12 @@ export const loginPortalAtom = atom(
|
|||||||
throw new AbnormalPortalConfigError("Empty user auth cookie");
|
throw new AbnormalPortalConfigError("Empty user auth cookie");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
`Retrieved ${gateways.length} gateways, userAuthCookie: ${redact(
|
||||||
|
userAuthCookie
|
||||||
|
)}, prelogonUserAuthCookie: ${redact(prelogonUserAuthCookie)}`
|
||||||
|
);
|
||||||
|
|
||||||
// Here, we have got the portal config successfully, refresh the cached portal data
|
// Here, we have got the portal config successfully, refresh the cached portal data
|
||||||
const previousSelectedGateway = get(selectedGatewayAtom)?.name;
|
const previousSelectedGateway = get(selectedGatewayAtom)?.name;
|
||||||
const selectedGateway = gateways.find(
|
const selectedGateway = gateways.find(
|
||||||
@ -106,7 +112,11 @@ export const loginPortalAtom = atom(
|
|||||||
preferredGateway: previousSelectedGateway,
|
preferredGateway: previousSelectedGateway,
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info(`Found the preferred gateway: ${name} (${redact(address)})`);
|
logger.info(
|
||||||
|
`Found the preferred gateway: ${name} (${redact(
|
||||||
|
address
|
||||||
|
)}) for region: ${region}`
|
||||||
|
);
|
||||||
|
|
||||||
// Log in to the gateway
|
// Log in to the gateway
|
||||||
await set(loginGatewayAtom, address, {
|
await set(loginGatewayAtom, address, {
|
||||||
|
Loading…
Reference in New Issue
Block a user