Skip to content

Commit 9f84f97

Browse files
committed
better check for existing emails in the profile info
1 parent 6944207 commit 9f84f97

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

apps/webapp/app/models/user.server.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ export type { User } from "@trigger.dev/database";
1111
import { assertEmailAllowed } from "~/utils/email";
1212
import { logger } from "~/services/logger.server";
1313

14-
export class AuthConflictError extends Error {
15-
constructor(
16-
message: string,
17-
public readonly existingEmailUserId: string,
18-
public readonly existingAuthUserId: string
19-
) {
20-
super(message);
21-
this.name = "AuthConflictError";
22-
}
23-
}
24-
2514
type FindOrCreateMagicLink = {
2615
authenticationMethod: "MAGIC_LINK";
2716
email: string;

apps/webapp/app/services/gitHubAuth.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function addGitHubStrategy(
2020
async ({ extraParams, profile }) => {
2121
const emails = profile.emails;
2222

23-
if (!emails) {
23+
if (!emails?.length) {
2424
throw new Error("GitHub login requires an email address");
2525
}
2626

apps/webapp/app/services/googleAuth.server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function addGoogleStrategy(
2020
async ({ extraParams, profile }) => {
2121
const emails = profile.emails;
2222

23-
if (!emails) {
23+
if (!emails?.length) {
2424
throw new Error("Google login requires an email address");
2525
}
2626

@@ -52,4 +52,3 @@ export function addGoogleStrategy(
5252

5353
authenticator.use(googleStrategy);
5454
}
55-

0 commit comments

Comments
 (0)