update pay function
This commit is contained in:
36
boilerplate-chakra-pro-main/app/auth/reset_password/route.ts
Normal file
36
boilerplate-chakra-pro-main/app/auth/reset_password/route.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { createClient } from '@/utils/supabase/server';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { NextRequest } from 'next/server';
|
||||
import { getErrorRedirect, getStatusRedirect } from '@/utils/helpers';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
// The `/auth/callback` route is required for the server-side auth flow implemented
|
||||
// by the `@supabase/ssr` package. It exchanges an auth code for the user's session.
|
||||
const requestUrl = new URL(request.url);
|
||||
const code = requestUrl.searchParams.get('code');
|
||||
|
||||
if (code) {
|
||||
const supabase = createClient();
|
||||
|
||||
const { error } = await supabase.auth.exchangeCodeForSession(code);
|
||||
|
||||
if (error) {
|
||||
return NextResponse.redirect(
|
||||
getErrorRedirect(
|
||||
`${requestUrl.origin}/signin/forgot_password`,
|
||||
error.name,
|
||||
"Sorry, we weren't able to log you in. Please try again."
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// URL to redirect to after sign in process completes
|
||||
return NextResponse.redirect(
|
||||
getStatusRedirect(
|
||||
`${requestUrl.origin}/signin/update_password`,
|
||||
'You are now signed in.',
|
||||
'Please enter a new password for your account.'
|
||||
)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user