Skip to content

Commit 35cf42e

Browse files
committed
fix several instances of using require instead of import
- so get possibly some typescript value, whereas require may discard that
1 parent c2c9744 commit 35cf42e

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/packages/server/auth/sso/oauth2-user-profile-callback.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
// https://github.com/passport-next/passport-oauth2/blob/master/lib/strategy.js#L276
99

1010
import jwt_decode from "jwt-decode";
11-
12-
const safeJsonStringify = require("safe-json-stringify");
13-
11+
import safeJsonStringify from "safe-json-stringify";
1412
import { parseOpenIdProfile } from "@cocalc/server/auth/sso/openid-parser";
1513
import { UserProfileCallbackOpts } from "@cocalc/database/settings/auth-sso-types";
1614

src/packages/server/hub/auth.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ import ms from "ms";
4343
import passport, { AuthenticateOptions } from "passport";
4444
import { join as path_join } from "path";
4545
import { v4 as uuidv4, v4 } from "uuid";
46-
const safeJsonStringify = require("safe-json-stringify");
47-
46+
import safeJsonStringify from "safe-json-stringify";
4847
import passwordHash, {
4948
verifyPassword,
5049
} from "@cocalc/backend/auth/password-hash";
@@ -99,7 +98,7 @@ import {
9998
GoogleStrategyConf,
10099
TwitterStrategyConf,
101100
} from "@cocalc/server/auth/sso/public-strategies";
102-
const sign_in = require("./sign-in");
101+
import { record_sign_in } from "./sign-in";
103102

104103
const logger = getLogger("server:hub:auth");
105104

@@ -615,7 +614,7 @@ export class PassportManager {
615614
passports: this.passports ?? {},
616615
database: this.database,
617616
host: this.host,
618-
record_sign_in: sign_in.record_sign_in,
617+
record_sign_in,
619618
id: profile.id, // ATTN: not all strategies have an ID → you have to derive the ID from the profile below via the "login_info" mapping (e.g. {id: "email"})
620619
strategyName: name,
621620
profile, // will just get saved in database

0 commit comments

Comments
 (0)