Upgrade deps + allow node 18.x (#5622)

* Upgrade deps + allow node 18.x

* Upgraded next-auth to v4.17

* Latest known to work version of next-auth

* Make next-auth.d.ts compatible with [email protected].0

* Type fixes

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Alex van AndelandPeer Richelsen authored and GitHub committed 2022-11-23 11:35:08 -07:00
1 parent 6dce57440e
commit b31b8cc6df
8 files changed
+1252 -149

No files matched your search

+2 -2
View File
@@ -19,11 +19,11 @@
"check-changed-files": "ts-node scripts/ts-check-changed-files.ts"
},
"engines": {
"node": "16.x",
"node": "16.x || 18.x",
"yarn": ">=1.19.0 < 2.0.0"
},
"dependencies": {
"@boxyhq/saml-jackson": "1.3.1",
"@boxyhq/saml-jackson": "1.3.6",
"@calcom/app-store": "*",
"@calcom/app-store-cli": "*",
"@calcom/core": "*",
+10 -8
View File
@@ -271,7 +271,7 @@ export default NextAuth({
username: user.username,
email: user.email,
role: user.role,
impersonatedByUID: user?.impersonatedByUID as number,
impersonatedByUID: user?.impersonatedByUID,
};
}
@@ -331,16 +331,16 @@ export default NextAuth({
async signIn(params) {
const { user, account, profile } = params;
if (account.provider === "email") {
if (account?.provider === "email") {
return true;
}
// In this case we've already verified the credentials in the authorize
// callback so we can sign the user in.
if (account.type === "credentials") {
if (account?.type === "credentials") {
return true;
}
if (account.type !== "oauth") {
if (account?.type !== "oauth") {
return false;
}
@@ -352,12 +352,14 @@ export default NextAuth({
return false;
}
if (account.provider) {
if (account?.provider) {
let idP: IdentityProvider = IdentityProvider.GOOGLE;
if (account.provider === "saml") {
idP = IdentityProvider.SAML;
}
user.email_verified = user.email_verified || user.emailVerified || profile.email_verified;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-error TODO validate email_verified key on profile
user.email_verified = user.email_verified || !!user.emailVerified || profile.email_verified;
if (!user.email_verified) {
return "/auth/error?error=unverified-email";
@@ -440,7 +442,7 @@ export default NextAuth({
emailVerified: new Date(Date.now()),
name: user.name,
identityProvider: idP,
identityProviderId: user.id as string,
identityProviderId: String(user.id),
},
});
@@ -463,7 +465,7 @@ export default NextAuth({
name: user.name,
email: user.email,
identityProvider: idP,
identityProviderId: user.id as string,
identityProviderId: String(user.id),
},
});
const linkAccountNewUserData = { ...account, userId: newUser.id };
+1 -1
View File
@@ -136,7 +136,7 @@ export async function getServerSideProps(context: NextPageContext) {
const session = await getSession();
// set meetingPassword to null for guests
if (session?.userid !== bookingObj.user?.id) {
if (session?.user.id !== bookingObj.user?.id) {
bookingObj.references.forEach((bookRef) => {
bookRef.meetingPassword = null;
});