Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 21 additions & 27 deletions src/pages/ForgotPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AuthCard } from "@/components/auth/AuthCard";
import { Button } from "@/components/ui/button";
import { InlineNotification } from "@/components/ui/inline-notification";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Field } from "@/components/ui/field";
import { useRouter } from "@/router";

export function ForgotPassword() {
Expand Down Expand Up @@ -71,33 +71,27 @@ export function ForgotPassword() {
</div>
) : (
<form onSubmit={handleSubmit} className="mt-6 space-y-4" noValidate>
<div className="space-y-1">
<Label htmlFor="email">{intl.formatMessage({ id: "auth.forgotPassword.email" })}</Label>
<Input
id="email"
name="email"
type="email"
autoComplete="email"
inputMode="email"
required
value={email}
onChange={(event) => {
setEmail(event.target.value);
setEmailError(null);
}}
aria-invalid={!!emailError}
aria-describedby={emailError ? "forgot-password-email-error" : undefined}
/>
{emailError && (
<p
id="forgot-password-email-error"
role="alert"
className="text-sm text-red-600 dark:text-red-400"
>
{emailError}
</p>
<Field
id="email"
label={intl.formatMessage({ id: "auth.forgotPassword.email" })}
error={emailError ?? undefined}
>
{(controlProps) => (
<Input
{...controlProps}
name="email"
type="email"
autoComplete="email"
inputMode="email"
required
value={email}
onChange={(event) => {
setEmail(event.target.value);
setEmailError(null);
}}
/>
)}
</div>
</Field>
{error && <InlineNotification type="error" message={error} />}
<Button type="submit" disabled={loading || !email.trim()} className="w-full">
{loading
Expand Down
74 changes: 39 additions & 35 deletions src/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ApiError } from "../api/client";
import { classifyLoginError } from "../api/loginErrors";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Field } from "@/components/ui/field";

export function Login() {
const intl = useIntl();
Expand Down Expand Up @@ -73,40 +73,44 @@ export function Login() {
{intl.formatMessage({ id: "auth.login.title" })}
</h1>
<form onSubmit={handleSubmit} className="space-y-4" noValidate>
<div>
<Label
htmlFor="email"
className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-1"
>
{intl.formatMessage({ id: "auth.login.email" })}
</Label>
<Input
id="email"
type="email"
autoComplete="email"
required
value={email}
onChange={(e) => setEmail(e.target.value)}
className="w-full border border-neutral-300 dark:border-neutral-600 rounded px-3 py-2 text-sm bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100 focus:outline-none focus:ring-2 focus:ring-neutral-900 dark:focus:ring-neutral-400"
/>
</div>
<div>
<Label
htmlFor="password"
className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-1"
>
{intl.formatMessage({ id: "auth.login.password" })}
</Label>
<Input
id="password"
type="password"
autoComplete="current-password"
required
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full border border-neutral-300 dark:border-neutral-600 rounded px-3 py-2 text-sm bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100 focus:outline-none focus:ring-2 focus:ring-neutral-900 dark:focus:ring-neutral-400"
/>
</div>
<Field
id="email"
label={intl.formatMessage({ id: "auth.login.email" })}
labelProps={{
className: "block text-sm font-medium text-neutral-700 dark:text-neutral-300",
}}
>
{(controlProps) => (
<Input
{...controlProps}
type="email"
autoComplete="email"
required
value={email}
onChange={(e) => setEmail(e.target.value)}
className="w-full border border-neutral-300 dark:border-neutral-600 rounded px-3 py-2 text-sm bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100 focus:outline-none focus:ring-2 focus:ring-neutral-900 dark:focus:ring-neutral-400"
/>
)}
</Field>
<Field
id="password"
label={intl.formatMessage({ id: "auth.login.password" })}
labelProps={{
className: "block text-sm font-medium text-neutral-700 dark:text-neutral-300",
}}
>
{(controlProps) => (
<Input
{...controlProps}
type="password"
autoComplete="current-password"
required
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full border border-neutral-300 dark:border-neutral-600 rounded px-3 py-2 text-sm bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100 focus:outline-none focus:ring-2 focus:ring-neutral-900 dark:focus:ring-neutral-400"
/>
)}
</Field>
{error && (
<p role="alert" className="text-sm text-red-600">
{error}
Expand Down
16 changes: 9 additions & 7 deletions src/pages/PasswordChangeRequired.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PasswordInput } from "@/components/users/PasswordInput";
import { Button } from "@/components/ui/button";
import { InlineNotification } from "@/components/ui/inline-notification";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Field } from "@/components/ui/field";
import { VALIDATION } from "@/lib/constants";
import {
countPasswordCharacterClasses,
Expand Down Expand Up @@ -192,12 +192,14 @@ export function PasswordChangeRequired() {
</div>
) : (
<form onSubmit={handleSubmit} className="mt-6 space-y-4" noValidate>
<div className="space-y-1">
<Label htmlFor="email">
{intl.formatMessage({ id: "auth.passwordChangeRequired.email" })}
</Label>
<Input id="email" type="email" value={email} disabled readOnly />
</div>
<Field
id="email"
label={intl.formatMessage({ id: "auth.passwordChangeRequired.email" })}
>
{(controlProps) => (
<Input {...controlProps} type="email" value={email} disabled readOnly />
)}
</Field>
<PasswordInput
ref={oldPasswordInputRef}
id="old-password"
Expand Down
Loading