mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 05:12:20 +00:00
show user not found error
This commit is contained in:
@@ -27,16 +27,11 @@ export async function POST(request: NextRequest) {
|
||||
return NextResponse.json(error, { status: 500 });
|
||||
});
|
||||
} else {
|
||||
throw "No user id found in session";
|
||||
throw { details: "No user id found in session" };
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
return NextResponse.json(
|
||||
{
|
||||
details: "could not add session to cookie",
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
return NextResponse.json(error, { status: 500 });
|
||||
});
|
||||
} else {
|
||||
return NextResponse.error();
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useForm } from "react-hook-form";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Spinner } from "./Spinner";
|
||||
import { LoginSettings } from "@zitadel/server";
|
||||
import Alert from "./Alert";
|
||||
|
||||
type Inputs = {
|
||||
loginName: string;
|
||||
@@ -54,7 +55,10 @@ export default function UsernameForm({
|
||||
|
||||
setLoading(false);
|
||||
if (!res.ok) {
|
||||
throw new Error("Failed to load authentication methods");
|
||||
const response = await res.json();
|
||||
|
||||
setError(response.details);
|
||||
return Promise.reject(response.details);
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
@@ -145,14 +149,16 @@ export default function UsernameForm({
|
||||
autoComplete="username"
|
||||
{...register("loginName", { required: "This field is required" })}
|
||||
label="Loginname"
|
||||
// error={errors.username?.message as string}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="py-4">
|
||||
<Alert>{error}</Alert>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-8 flex w-full flex-row items-center">
|
||||
{/* <Button type="button" variant={ButtonVariants.Secondary}>
|
||||
back
|
||||
</Button> */}
|
||||
<span className="flex-grow"></span>
|
||||
<Button
|
||||
type="submit"
|
||||
|
||||
Reference in New Issue
Block a user