forked from administration/panel
fix: use callback url if present
parent
2c3ad1082e
commit
68851f1b17
|
@ -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
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue