find sessions for loginHint, send to select account

This commit is contained in:
peintnermax
2023-08-29 14:43:51 +02:00
parent 8056c81161
commit 338c28cd88
6 changed files with 120 additions and 34 deletions

View File

@@ -9,9 +9,11 @@ import { XCircleIcon } from "@heroicons/react/24/outline";
export default function SessionItem({
session,
reload,
authRequestId,
}: {
session: Session;
reload: () => void;
authRequestId?: string;
}) {
const [loading, setLoading] = useState<boolean>(false);
@@ -52,10 +54,18 @@ export default function SessionItem({
loginName: session.factors?.user?.loginName as string,
})
: `/loginname?` +
new URLSearchParams({
loginName: session.factors?.user?.loginName as string,
submit: "true",
})
new URLSearchParams(
authRequestId
? {
loginName: session.factors?.user?.loginName as string,
submit: "true",
authRequestId,
}
: {
loginName: session.factors?.user?.loginName as string,
submit: "true",
}
)
}
className="group flex flex-row items-center bg-background-light-400 dark:bg-background-dark-400 border border-divider-light hover:shadow-lg dark:hover:bg-white/10 py-2 px-4 rounded-md transition-all"
>

View File

@@ -7,9 +7,10 @@ import { useEffect, useState } from "react";
type Props = {
sessions: Session[];
authRequestId?: string;
};
export default function SessionsList({ sessions }: Props) {
export default function SessionsList({ sessions, authRequestId }: Props) {
const [list, setList] = useState<Session[]>(sessions);
return sessions ? (
<div className="flex flex-col space-y-2">
@@ -19,6 +20,7 @@ export default function SessionsList({ sessions }: Props) {
return (
<SessionItem
session={session}
authRequestId={authRequestId}
reload={() => {
setList(list.filter((s) => s.id !== session.id));
}}