[portal][feat] configure Next Auth's sign in route to point to custom login page

pull/528/head
Yangshun Tay 2 years ago
parent 0cdd5ac9a1
commit 9d0721c4f9

@ -2,7 +2,7 @@ export default function loginPageHref(redirectUrl?: string) {
return {
pathname: '/login',
query: {
redirect:
callbackUrl:
typeof window !== 'undefined'
? redirectUrl ?? window.location.href
: null,

@ -20,6 +20,9 @@ export const authOptions: NextAuthOptions = {
return session;
},
},
pages: {
signIn: '/login',
},
providers: [
GitHubProvider({
clientId: env.GITHUB_CLIENT_ID,

@ -54,9 +54,9 @@ export default function LoginPage({
onClick={() =>
signIn(
provider.id,
router.query.redirect != null
router.query.callbackUrl != null
? {
callbackUrl: String(router.query.redirect),
callbackUrl: String(router.query.callbackUrl),
}
: undefined,
)

@ -127,7 +127,7 @@ export default function SettingsPage() {
}
if (session == null) {
return null;
return <p>You are not signed in</p>;
}
return (

Loading…
Cancel
Save