feat: SW-158 Optimized comments
This commit is contained in:
@@ -15,7 +15,8 @@ export async function GET(
|
|||||||
let redirectTo: string
|
let redirectTo: string
|
||||||
let loginKey: string | null
|
let loginKey: string | null
|
||||||
|
|
||||||
redirectTo = request.cookies.get("Scandic-auth.callback-url")?.value || "/" // Cookie gets set by NextAuth from login initiation
|
// Set callback from Cookie set by NextAuth when intiating login
|
||||||
|
redirectTo = request.cookies.get("Scandic-auth.callback-url")?.value || "/"
|
||||||
|
|
||||||
// Make relative URL to absolute URL
|
// Make relative URL to absolute URL
|
||||||
if (redirectTo.startsWith("/")) {
|
if (redirectTo.startsWith("/")) {
|
||||||
@@ -25,9 +26,10 @@ export async function GET(
|
|||||||
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove Seamless login as it doesn't work with Magic link login
|
// Remove Seamless login as it doesn't work with Magic link login due to different authenticators
|
||||||
if (redirectTo.indexOf("updatelogin?returnurl") !== -1) {
|
if (redirectTo.indexOf("updatelogin?returnurl") !== -1) {
|
||||||
// Additional URL decode required as url in the query parameter is encoded twice due to passed in query param and further in cookie value.
|
// Additional URL decode required as url in the query parameter is encoded twice as
|
||||||
|
// passed in query param and further in cookie value.
|
||||||
redirectTo = decodeURIComponent(
|
redirectTo = decodeURIComponent(
|
||||||
redirectTo.substring(redirectTo.indexOf("returnurl") + 10)
|
redirectTo.substring(redirectTo.indexOf("returnurl") + 10)
|
||||||
)
|
)
|
||||||
|
|||||||
2
auth.ts
2
auth.ts
@@ -192,6 +192,8 @@ export const config = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
cookies: {
|
cookies: {
|
||||||
|
// Specific cookie name required to reset callback url when login using
|
||||||
|
// Email verification link (Magic link) scenario
|
||||||
callbackUrl: {
|
callbackUrl: {
|
||||||
name: `Scandic-auth.callback-url`,
|
name: `Scandic-auth.callback-url`,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
Reference in New Issue
Block a user