Skip to content

Commit

Permalink
fix: remove hardcoded redirect in signin url email verification (#2764)
Browse files Browse the repository at this point in the history
Co-authored-by: Agusti Fernandez Pardo <git@agusti.me>
  • Loading branch information
2 people authored and zomars committed May 16, 2022
1 parent ae15a7d commit 27540b0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions apps/web/pages/api/auth/[...nextauth].tsx
Expand Up @@ -165,9 +165,6 @@ if (true) {
maxAge: 10 * 60 * 60, // Magic links are valid for 10 min only
// Here we setup the sendVerificationRequest that calls the email template with the identifier (email) and token to verify.
sendVerificationRequest: ({ identifier, url }) => {
// Here we add /new endpoint to the callback URL by adding it before &token=.
// This is not elegant but it works. We should probably use a different approach when we can.
url = url.includes("/auth/new") ? url : url.replace("&token", "/auth/new&token");
const emailFile = readFileSync(path.join(emailsDir, "confirm-email.html"), {
encoding: "utf8",
});
Expand Down Expand Up @@ -198,7 +195,7 @@ export default NextAuth({
signIn: "/auth/login",
signOut: "/auth/logout",
error: "/auth/error", // Error code passed in query string as ?error=
newUser: "/auth/new", // New users will be directed here on first sign in (leave the property out if not of interest)
// newUser: "/auth/new", // New users will be directed here on first sign in (leave the property out if not of interest)
},
providers,
callbacks: {
Expand Down

1 comment on commit 27540b0

@vercel
Copy link

@vercel vercel bot commented on 27540b0 May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cal – ./apps/web

app.cal.com
cal-cal.vercel.app
cal-git-production-cal.vercel.app
app.calendso.com

Please sign in to comment.