reps raised with correct return url

This commit is contained in:
2023-10-25 10:33:08 +01:00
parent fdf5be3415
commit f3da69dc75
5 changed files with 61 additions and 52 deletions
+16 -21
View File
@@ -155,14 +155,7 @@ const authOptions = (locale, req) => {
const personalisation = {
"emailAddress": email,
"signInLink": url,
"signInLink":
newURL +
"/api/auth/callback/email?callbackUrl=" +
encodeURIComponent(newURL) +
"&token=" +
searchParams.get("token") +
"&email=" +
encodeURIComponent(email),
"linkExpiry": 10 * 60,
};
const reference = "PEDW-SIGNIN";
@@ -220,19 +213,21 @@ const authOptions = (locale, req) => {
//console.log(user);
return Promise.resolve(session);
},
async redirect({ url, baseUrl }) {
// // Allows relative callback URLs
// if (url.startsWith("/")) return `${baseUrl}${url}`;
// // Allows callback URLs on the same origin
// else if (new URL(url).origin === baseUrl) return url;
let newURL =
locale == "cy"
? process.env.CY_API_ROOT
: process.env.NEXTAUTH_URL;
//console.log("baseurl:", newURL);
//return baseUrl;
return newURL;
},
// redirect({ url, baseUrl }) {
// debugger;
// console.log("baseurl:", url, baseUrl);
// // Allows relative callback URLs
// if (url.startsWith("/")) return `${baseUrl}${url}`;
// // Allows callback URLs on the same origin
// else if (new URL(url).origin === baseUrl) return url;
// // let newURL =
// // locale == "cy"
// // ? process.env.CY_API_ROOT
// // : process.env.NEXTAUTH_URL;
// //return baseUrl;
// // return newURL;
// },
},
};
};