mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-25 00:22:43 -05:00
feat: ip and user agent on sessin
This commit is contained in:
Binary file not shown.
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user