Skip to content
Open
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
38 changes: 29 additions & 9 deletions resources/js/pages/auth/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { register } from '@/routes';
import { store } from '@/routes/login';
import { request } from '@/routes/password';
import { Form, Head } from '@inertiajs/react';
import { useState } from 'react';
import { Eye, EyeOff } from 'lucide-react';

interface LoginProps {
status?: string;
Expand All @@ -22,6 +24,8 @@ export default function Login({
canResetPassword,
canRegister,
}: LoginProps) {
const [showPassword, setShowPassword] = useState(false);

return (
<AuthLayout
title="Log in to your account"
Expand Down Expand Up @@ -65,15 +69,31 @@ export default function Login({
</TextLink>
)}
</div>
<Input
id="password"
type="password"
name="password"
required
tabIndex={2}
autoComplete="current-password"
placeholder="Password"
/>
<div className="relative">
<Input
id="password"
type={showPassword ? 'text' : 'password'}
name="password"
required
tabIndex={2}
autoComplete="current-password"
placeholder="Password"
className="pr-10"
aria-describedby="password-help"
/>
<Button
type="button"
variant="ghost"
size="icon"
tabIndex={2}
className="absolute right-0 top-0 h-9 w-9 text-muted-foreground cursor-pointer"
onClick={() => setShowPassword((v) => !v)}
aria-label={showPassword ? 'Hide password' : 'Show password'}
title={showPassword ? 'Hide password' : 'Show password'}
>
{showPassword ? <EyeOff aria-hidden="true" /> : <Eye aria-hidden="true" />}
</Button>
</div>
<InputError message={errors.password} />
</div>

Expand Down
72 changes: 54 additions & 18 deletions resources/js/pages/auth/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Spinner } from '@/components/ui/spinner';
import AuthLayout from '@/layouts/auth-layout';
import { useState } from 'react';
import { Eye, EyeOff } from 'lucide-react';

export default function Register() {
const [showPassword, setShowPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
return (
<AuthLayout
title="Create an account"
Expand Down Expand Up @@ -60,31 +64,63 @@ export default function Register() {

<div className="grid gap-2">
<Label htmlFor="password">Password</Label>
<Input
id="password"
type="password"
required
tabIndex={3}
autoComplete="new-password"
name="password"
placeholder="Password"
/>
<div className="relative">
<Input
id="password"
type={showPassword ? 'text' : 'password'}
required
tabIndex={3}
autoComplete="new-password"
name="password"
placeholder="Password"
className="pr-10"
aria-describedby="password-help"
/>
<Button
type="button"
variant="ghost"
size="icon"
tabIndex={3}
className="absolute right-0 top-0 h-9 w-9 text-muted-foreground cursor-pointer"
onClick={() => setShowPassword((v) => !v)}
aria-label={showPassword ? 'Hide password' : 'Show password'}
title={showPassword ? 'Hide password' : 'Show password'}
>
{showPassword ? <EyeOff aria-hidden="true" /> : <Eye aria-hidden="true" />}
</Button>
</div>
<InputError message={errors.password} />
</div>

<div className="grid gap-2">
<Label htmlFor="password_confirmation">
Confirm password
</Label>
<Input
id="password_confirmation"
type="password"
required
tabIndex={4}
autoComplete="new-password"
name="password_confirmation"
placeholder="Confirm password"
/>
<div className="relative">
<Input
id="password_confirmation"
type={showConfirmPassword ? 'text' : 'password'}
required
tabIndex={4}
autoComplete="new-password"
name="password_confirmation"
placeholder="Confirm password"
className="pr-10"
aria-describedby="password-confirmation-help"
/>
<Button
type="button"
variant="ghost"
size="icon"
tabIndex={4}
className="absolute right-0 top-0 h-9 w-9 text-muted-foreground cursor-pointer"
onClick={() => setShowConfirmPassword((v) => !v)}
aria-label={showConfirmPassword ? 'Hide password' : 'Show password'}
title={showConfirmPassword ? 'Hide password' : 'Show password'}
>
{showConfirmPassword ? <EyeOff aria-hidden="true" /> : <Eye aria-hidden="true" />}
</Button>
</div>
<InputError
message={errors.password_confirmation}
/>
Expand Down