1
0
Fork 0

fix: use callback url if present

fix-1
Paul Makles 2023-07-30 12:14:09 +01:00
parent 2c3ad1082e
commit 68851f1b17
No known key found for this signature in database
GPG Key ID: 5059F398521BB0F6
2 changed files with 9 additions and 2 deletions

View File

@ -4,4 +4,3 @@ import NextAuth from "next-auth";
const handler = NextAuth(authOptions); const handler = NextAuth(authOptions);
export { handler as GET, handler as POST }; export { handler as GET, handler as POST };
// admin.revolt.chat/panel/this/should/redirect/any/path

View File

@ -6,6 +6,7 @@ import Link from "next/link";
export function LoginButton() { export function LoginButton() {
const { data: session } = useSession(); const { data: session } = useSession();
const params = new URLSearchParams(document.location.search);
if (session) { if (session) {
return ( return (
@ -26,7 +27,14 @@ export function LoginButton() {
return ( return (
<> <>
<Button variant="outline" onClick={() => signIn("authentik")}> <Button
variant="outline"
onClick={() =>
signIn("authentik", {
callbackUrl: params.get("callbackUrl") ?? undefined,
})
}
>
login with revolt sso login with revolt sso
</Button> </Button>
<img <img