feat: ip and user agent on sessin

This commit is contained in:
Bereket Engida
2024-08-28 11:06:56 +03:00
parent 358b4488c1
commit ed3579d19e
24 changed files with 7800 additions and 132 deletions

Binary file not shown.

View File

@@ -85,7 +85,9 @@ export default function Page() {
Login with Github
</Button>
<Button variant="secondary" className="gap-2" onClick={async () => {
await authClient.passkey.signIn()
await authClient.passkey.signIn({
callbackURL: "/"
})
}}>
<Key size={16} />
Login with Passkey

View File

@@ -4,11 +4,18 @@ import { authClient } from "./lib/auth-client";
export async function middleware(request: NextRequest) {
const session = await authClient.session({
headers: request.headers,
options: {
headers: request.headers,
},
});
if (!session.data) {
return NextResponse.redirect(new URL("/sign-in", request.url));
}
const canInvite = await authClient.org.hasPermission({
permission: {
invitation: ["create"],
},
});
return NextResponse.next();
}