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,15 +64,20 @@ export const connectPortalAtom = atom(
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (err instanceof AbnormalPortalConfigError) {
|
||||
logger.info(
|
||||
`Got abnormal portal config: ${err.message}, retrying...`
|
||||
);
|
||||
prelogin = await portalService.prelogin(portal);
|
||||
continue;
|
||||
} else {
|
||||
if (!(err instanceof AbnormalPortalConfigError)) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
logger.info(
|
||||
`Got abnormal portal config: ${err.message}, retrying...`
|
||||
);
|
||||
set(statusAtom, "prelogin");
|
||||
prelogin = await portalService.prelogin(portal);
|
||||
const isProcessing = get(isProcessingAtom);
|
||||
if (!isProcessing) {
|
||||
logger.info("Operation cancelled");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { atom } from "jotai";
|
||||
import gatewayService from "../services/gatewayService";
|
||||
import logger from "../utils/logger";
|
||||
import { redact } from "../utils/redact";
|
||||
import { isProcessingAtom, statusAtom } from "./status";
|
||||
import { connectVpnAtom } from "./vpn";
|
||||
|
||||
@ -20,7 +21,7 @@ export const loginGatewayAtom = atom(
|
||||
set(statusAtom, "gateway-login");
|
||||
let token: string;
|
||||
try {
|
||||
logger.info(`Logging in to gateway ${gateway}...`);
|
||||
logger.info(`Logging in to gateway ${redact(gateway)}...`);
|
||||
token = await gatewayService.login(gateway, credential);
|
||||
} catch (err) {
|
||||
throw new Error("Failed to login to gateway");
|
||||
|
@ -80,6 +80,12 @@ export const loginPortalAtom = atom(
|
||||
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
|
||||
const previousSelectedGateway = get(selectedGatewayAtom)?.name;
|
||||
const selectedGateway = gateways.find(
|
||||
@ -106,7 +112,11 @@ export const loginPortalAtom = atom(
|
||||
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
|
||||
await set(loginGatewayAtom, address, {
|
||||
|
Loading…
Reference in New Issue
Block a user