109 lines
4.4 KiB
JavaScript
109 lines
4.4 KiB
JavaScript
import { jsxs, jsx } from "react/jsx-runtime";
|
|
import { useForm, Head, Link } from "@inertiajs/react";
|
|
import classNames from "classnames";
|
|
import { u as useRoute } from "../app.js";
|
|
import { A as AuthenticationCard } from "./AuthenticationCard--MCzdtHR.js";
|
|
import { C as Checkbox } from "./Checkbox-XR8K_oHK.js";
|
|
import { I as InputLabel } from "./InputLabel-DhqxoV6M.js";
|
|
import { P as PrimaryButton } from "./PrimaryButton-C2B8UWiv.js";
|
|
import { T as TextInput, I as InputError } from "./TextInput-CMJy2hIv.js";
|
|
import "axios";
|
|
import "lodash";
|
|
import "react-dom/client";
|
|
import "react";
|
|
import "./AuthenticationCardLogo-CZgVhhfE.js";
|
|
function Login({ canResetPassword, status }) {
|
|
const route = useRoute();
|
|
const form = useForm({
|
|
email: "",
|
|
password: "",
|
|
remember: ""
|
|
});
|
|
function onSubmit(e) {
|
|
e.preventDefault();
|
|
form.post(route("login"), {
|
|
onFinish: () => form.reset("password")
|
|
});
|
|
}
|
|
return /* @__PURE__ */ jsxs(AuthenticationCard, { children: [
|
|
/* @__PURE__ */ jsx(Head, { title: "Login" }),
|
|
status && /* @__PURE__ */ jsx("div", { className: "mb-4 font-medium text-sm text-green-600 dark:text-green-400", children: status }),
|
|
/* @__PURE__ */ jsxs("form", { onSubmit, children: [
|
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
/* @__PURE__ */ jsx(InputLabel, { htmlFor: "email", children: "Email" }),
|
|
/* @__PURE__ */ jsx(
|
|
TextInput,
|
|
{
|
|
id: "email",
|
|
type: "email",
|
|
className: "mt-1 block w-full",
|
|
value: form.data.email,
|
|
onChange: (e) => form.setData("email", e.currentTarget.value),
|
|
required: true,
|
|
autoFocus: true
|
|
}
|
|
),
|
|
/* @__PURE__ */ jsx(InputError, { className: "mt-2", message: form.errors.email })
|
|
] }),
|
|
/* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
|
|
/* @__PURE__ */ jsx(InputLabel, { htmlFor: "password", children: "Password" }),
|
|
/* @__PURE__ */ jsx(
|
|
TextInput,
|
|
{
|
|
id: "password",
|
|
type: "password",
|
|
className: "mt-1 block w-full",
|
|
value: form.data.password,
|
|
onChange: (e) => form.setData("password", e.currentTarget.value),
|
|
required: true,
|
|
autoComplete: "current-password"
|
|
}
|
|
),
|
|
/* @__PURE__ */ jsx(InputError, { className: "mt-2", message: form.errors.password })
|
|
] }),
|
|
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("label", { className: "flex items-center", children: [
|
|
/* @__PURE__ */ jsx(
|
|
Checkbox,
|
|
{
|
|
name: "remember",
|
|
checked: form.data.remember === "on",
|
|
onChange: (e) => form.setData("remember", e.currentTarget.checked ? "on" : "")
|
|
}
|
|
),
|
|
/* @__PURE__ */ jsx("span", { className: "ml-2 text-sm text-gray-600 dark:text-gray-400", children: "Remember me" })
|
|
] }) }),
|
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2 md:flex-row md:items-center md:justify-between md:space-y-0 mt-4", children: [
|
|
canResetPassword && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
Link,
|
|
{
|
|
href: route("password.request"),
|
|
className: "underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800",
|
|
children: "Forgot your password?"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end", children: [
|
|
/* @__PURE__ */ jsx(
|
|
Link,
|
|
{
|
|
href: route("register"),
|
|
className: "underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800",
|
|
children: "Need an account?"
|
|
}
|
|
),
|
|
/* @__PURE__ */ jsx(
|
|
PrimaryButton,
|
|
{
|
|
className: classNames("ml-4", { "opacity-25": form.processing }),
|
|
disabled: form.processing,
|
|
children: "Log in"
|
|
}
|
|
)
|
|
] })
|
|
] })
|
|
] })
|
|
] });
|
|
}
|
|
export {
|
|
Login as default
|
|
};
|