login.tsx — ui Source File
Architecture documentation for login.tsx, a tsx file in the ui codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 720c9764_389f_05a1_ed4b_747e979f904a["login.tsx"] ce9dd226_41a3_f031_caf3_5378288c23c1["node"] 720c9764_389f_05a1_ed4b_747e979f904a --> ce9dd226_41a3_f031_caf3_5378288c23c1 b969017e_0ead_3c70_277e_2e4416d7a8ed["react"] 720c9764_389f_05a1_ed4b_747e979f904a --> b969017e_0ead_3c70_277e_2e4416d7a8ed 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 720c9764_389f_05a1_ed4b_747e979f904a --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 052778fd_1a4c_7f8d_8295_ec523652ac24["user.server"] 720c9764_389f_05a1_ed4b_747e979f904a --> 052778fd_1a4c_7f8d_8295_ec523652ac24 a16e75e5_8d49_95a1_3e98_b347fb9dbfb5["session.server"] 720c9764_389f_05a1_ed4b_747e979f904a --> a16e75e5_8d49_95a1_3e98_b347fb9dbfb5 f7a8c102_dd23_93be_c89e_8d95a5739b59["utils"] 720c9764_389f_05a1_ed4b_747e979f904a --> f7a8c102_dd23_93be_c89e_8d95a5739b59 style 720c9764_389f_05a1_ed4b_747e979f904a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type {
ActionFunctionArgs,
LoaderFunctionArgs,
MetaFunction,
} from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Form, Link, useActionData, useSearchParams } from "@remix-run/react";
import { useEffect, useRef } from "react";
import { verifyLogin } from "~/models/user.server";
import { createUserSession, getUserId } from "~/session.server";
import { safeRedirect, validateEmail } from "~/utils";
export const loader = async ({ request }: LoaderFunctionArgs) => {
const userId = await getUserId(request);
if (userId) return redirect("/");
return json({});
};
export const action = async ({ request }: ActionFunctionArgs) => {
const formData = await request.formData();
const email = formData.get("email");
const password = formData.get("password");
const redirectTo = safeRedirect(formData.get("redirectTo"), "/");
const remember = formData.get("remember");
if (!validateEmail(email)) {
return json(
{ errors: { email: "Email is invalid", password: null } },
{ status: 400 },
);
}
if (typeof password !== "string" || password.length === 0) {
return json(
{ errors: { email: null, password: "Password is required" } },
{ status: 400 },
);
}
if (password.length < 8) {
return json(
{ errors: { email: null, password: "Password is too short" } },
{ status: 400 },
);
}
const user = await verifyLogin(email, password);
if (!user) {
return json(
{ errors: { email: "Invalid email or password", password: null } },
{ status: 400 },
);
}
return createUserSession({
redirectTo,
remember: remember === "on" ? true : false,
request,
// ... (121 more lines)
Domain
Subdomains
Functions
Dependencies
- node
- react
- react
- session.server
- user.server
- utils
Source
Frequently Asked Questions
What does login.tsx do?
login.tsx is a source file in the ui codebase, written in tsx. It belongs to the FrameworkTooling domain, TemplateSync subdomain.
What functions are defined in login.tsx?
login.tsx defines 4 function(s): LoginPage, action, loader, meta.
What does login.tsx depend on?
login.tsx imports 6 module(s): node, react, react, session.server, user.server, utils.
Where is login.tsx in the architecture?
login.tsx is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/login.tsx (domain: FrameworkTooling, subdomain: TemplateSync, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free