add eye for all password fields
Build & Deploy / Build & Push Docker Image (push) Failing after 7s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / Type Check (all packages) (push) Failing after 26s
Test / API Unit Tests (push) Has been skipped
Test / Homepage Unit Tests (push) Has been skipped
Test / Storefront Unit Tests (push) Has been skipped
Test / Admin Unit Tests (push) Has been skipped
Test / Dashboard Unit Tests (push) Has been skipped
Test / API Integration Tests (push) Has been skipped

This commit is contained in:
root
2026-06-27 23:12:24 -04:00
parent 59b58d02ea
commit e6460de4d0
6 changed files with 291 additions and 93 deletions
@@ -31,6 +31,7 @@ export default function AdminUsersPage() {
const [showModal, setShowModal] = useState(false) const [showModal, setShowModal] = useState(false)
const [editingAdminId, setEditingAdminId] = useState<string | null>(null) const [editingAdminId, setEditingAdminId] = useState<string | null>(null)
const [form, setForm] = useState(EMPTY_FORM) const [form, setForm] = useState(EMPTY_FORM)
const [showPassword, setShowPassword] = useState(false)
const [saving, setSaving] = useState(false) const [saving, setSaving] = useState(false)
async function fetchAdmins() { async function fetchAdmins() {
@@ -54,6 +55,7 @@ export default function AdminUsersPage() {
function openCreateModal() { function openCreateModal() {
setEditingAdminId(null) setEditingAdminId(null)
setForm(EMPTY_FORM) setForm(EMPTY_FORM)
setShowPassword(false)
setError(null) setError(null)
setShowModal(true) setShowModal(true)
} }
@@ -75,6 +77,7 @@ export default function AdminUsersPage() {
function closeModal() { function closeModal() {
setShowModal(false) setShowModal(false)
setEditingAdminId(null) setEditingAdminId(null)
setShowPassword(false)
setForm(EMPTY_FORM) setForm(EMPTY_FORM)
} }
@@ -232,14 +235,33 @@ export default function AdminUsersPage() {
<label className="block text-xs font-medium text-zinc-400 mb-1"> <label className="block text-xs font-medium text-zinc-400 mb-1">
Password {editingAdminId ? <span className="text-zinc-500">(leave blank to keep current)</span> : null} Password {editingAdminId ? <span className="text-zinc-500">(leave blank to keep current)</span> : null}
</label> </label>
<input <div className="relative">
type="password" <input
required={!editingAdminId} type={showPassword ? 'text' : 'password'}
minLength={editingAdminId ? undefined : 8} required={!editingAdminId}
className="w-full px-3 py-2 rounded-xl bg-zinc-800 border border-zinc-700 text-zinc-100 text-sm focus:outline-none focus:ring-2 focus:ring-emerald-500" minLength={editingAdminId ? undefined : 8}
value={form.password} className="w-full px-3 py-2 pr-10 rounded-xl bg-zinc-800 border border-zinc-700 text-zinc-100 text-sm focus:outline-none focus:ring-2 focus:ring-emerald-500"
onChange={(e) => setForm({ ...form, password: e.target.value })} value={form.password}
/> onChange={(e) => setForm({ ...form, password: e.target.value })}
/>
<button
type="button"
onClick={() => setShowPassword((v) => !v)}
className="absolute inset-y-0 right-3 flex items-center text-zinc-500 hover:text-zinc-200"
tabIndex={-1}
>
{showPassword ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</div> </div>
<div> <div>
<label className="block text-xs font-medium text-zinc-400 mb-1">Role</label> <label className="block text-xs font-medium text-zinc-400 mb-1">Role</label>
+58 -18
View File
@@ -20,7 +20,9 @@ function AdminResetPasswordContent() {
const token = searchParams.get('token') const token = searchParams.get('token')
const [password, setPassword] = useState('') const [password, setPassword] = useState('')
const [showPassword, setShowPassword] = useState(false)
const [confirm, setConfirm] = useState('') const [confirm, setConfirm] = useState('')
const [showConfirm, setShowConfirm] = useState(false)
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [done, setDone] = useState(false) const [done, setDone] = useState(false)
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
@@ -95,27 +97,65 @@ function AdminResetPasswordContent() {
)} )}
<div> <div>
<label className="mb-1.5 block text-sm font-medium text-zinc-300">New password</label> <label className="mb-1.5 block text-sm font-medium text-zinc-300">New password</label>
<input <div className="relative">
type="password" <input
required type={showPassword ? 'text' : 'password'}
minLength={8} required
value={password} minLength={8}
onChange={(e) => setPassword(e.target.value)} value={password}
placeholder="••••••••" onChange={(e) => setPassword(e.target.value)}
className="w-full rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm text-stone-900 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-orange-500 dark:border-blue-800 dark:bg-[#07101e]/80 dark:text-stone-100" placeholder="••••••••"
/> className="w-full rounded-2xl border border-stone-200 bg-white px-4 py-3 pr-10 text-sm text-stone-900 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-orange-500 dark:border-blue-800 dark:bg-[#07101e]/80 dark:text-stone-100"
/>
<button
type="button"
onClick={() => setShowPassword((v) => !v)}
className="absolute inset-y-0 right-3 flex items-center text-stone-400 hover:text-stone-700 dark:text-stone-500 dark:hover:text-stone-200"
tabIndex={-1}
>
{showPassword ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</div> </div>
<div> <div>
<label className="mb-1.5 block text-sm font-medium text-zinc-300">Confirm password</label> <label className="mb-1.5 block text-sm font-medium text-zinc-300">Confirm password</label>
<input <div className="relative">
type="password" <input
required type={showConfirm ? 'text' : 'password'}
minLength={8} required
value={confirm} minLength={8}
onChange={(e) => setConfirm(e.target.value)} value={confirm}
placeholder="••••••••" onChange={(e) => setConfirm(e.target.value)}
className="w-full rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm text-stone-900 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-orange-500 dark:border-blue-800 dark:bg-[#07101e]/80 dark:text-stone-100" placeholder="••••••••"
/> className="w-full rounded-2xl border border-stone-200 bg-white px-4 py-3 pr-10 text-sm text-stone-900 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-orange-500 dark:border-blue-800 dark:bg-[#07101e]/80 dark:text-stone-100"
/>
<button
type="button"
onClick={() => setShowConfirm((v) => !v)}
className="absolute inset-y-0 right-3 flex items-center text-stone-400 hover:text-stone-700 dark:text-stone-500 dark:hover:text-stone-200"
tabIndex={-1}
>
{showConfirm ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</div> </div>
<button <button
type="submit" type="submit"
@@ -308,6 +308,7 @@ export default function SettingsPage() {
const [newInsurance, setNewInsurance] = useState(emptyInsurance) const [newInsurance, setNewInsurance] = useState(emptyInsurance)
const [newRule, setNewRule] = useState(emptyRule) const [newRule, setNewRule] = useState(emptyRule)
const [customDomain, setCustomDomain] = useState('') const [customDomain, setCustomDomain] = useState('')
const [showSecretKey, setShowSecretKey] = useState(false)
const [uploadingAsset, setUploadingAsset] = useState<'logo' | 'hero' | null>(null) const [uploadingAsset, setUploadingAsset] = useState<'logo' | 'hero' | null>(null)
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const [saving, setSaving] = useState(false) const [saving, setSaving] = useState(false)
@@ -632,7 +633,26 @@ export default function SettingsPage() {
</div> </div>
<div> <div>
<label className="mb-1.5 block text-sm font-medium text-slate-700">{copy.amanpaySecretKey}</label> <label className="mb-1.5 block text-sm font-medium text-slate-700">{copy.amanpaySecretKey}</label>
<input className="input-field" type="password" value={brand.amanpaySecretKey ?? ''} onChange={(event) => setBrand((current) => current ? { ...current, amanpaySecretKey: event.target.value } : current)} /> <div className="relative">
<input className="input-field pr-10" type={showSecretKey ? 'text' : 'password'} value={brand.amanpaySecretKey ?? ''} onChange={(event) => setBrand((current) => current ? { ...current, amanpaySecretKey: event.target.value } : current)} />
<button
type="button"
onClick={() => setShowSecretKey((v) => !v)}
className="absolute inset-y-0 right-3 flex items-center text-slate-400 hover:text-slate-600"
tabIndex={-1}
>
{showSecretKey ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</div> </div>
<div> <div>
<label className="mb-1.5 block text-sm font-medium text-slate-700">{copy.paypalEmail}</label> <label className="mb-1.5 block text-sm font-medium text-slate-700">{copy.paypalEmail}</label>
+27 -7
View File
@@ -14,6 +14,7 @@ export default function OnboardingPage() {
const [step, setStep] = useState<Step>(1) const [step, setStep] = useState<Step>(1)
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const [showSecretKey, setShowSecretKey] = useState(false)
const [company, setCompany] = useState({ name: '', slug: '' }) const [company, setCompany] = useState({ name: '', slug: '' })
const [brand, setBrand] = useState({ const [brand, setBrand] = useState({
@@ -226,13 +227,32 @@ export default function OnboardingPage() {
</div> </div>
<div> <div>
<label className="block text-sm font-medium text-slate-700 mb-1">AmanPay Secret Key <span className="text-slate-400">(optional)</span></label> <label className="block text-sm font-medium text-slate-700 mb-1">AmanPay Secret Key <span className="text-slate-400">(optional)</span></label>
<input <div className="relative">
type="password" <input
className="input-field" type={showSecretKey ? 'text' : 'password'}
placeholder="your-secret-key" className="input-field pr-10"
value={payments.amanpaySecretKey} placeholder="your-secret-key"
onChange={(e) => setPayments({ ...payments, amanpaySecretKey: e.target.value })} value={payments.amanpaySecretKey}
/> onChange={(e) => setPayments({ ...payments, amanpaySecretKey: e.target.value })}
/>
<button
type="button"
onClick={() => setShowSecretKey((v) => !v)}
className="absolute inset-y-0 right-3 flex items-center text-slate-400 hover:text-slate-600"
tabIndex={-1}
>
{showSecretKey ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</div> </div>
<div> <div>
<label className="block text-sm font-medium text-slate-700 mb-1">PayPal email <span className="text-slate-400">(optional)</span></label> <label className="block text-sm font-medium text-slate-700 mb-1">PayPal email <span className="text-slate-400">(optional)</span></label>
@@ -90,7 +90,9 @@ function ResetPasswordContent({ locale }: { locale: Locale }) {
const token = searchParams.get('token'); const token = searchParams.get('token');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
const [confirm, setConfirm] = useState(''); const [confirm, setConfirm] = useState('');
const [showConfirm, setShowConfirm] = useState(false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [done, setDone] = useState(false); const [done, setDone] = useState(false);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
@@ -236,49 +238,111 @@ function ResetPasswordContent({ locale }: { locale: Locale }) {
) : null} ) : null}
<FormField id="reset-password" label={dict.newPassword} required> <FormField id="reset-password" label={dict.newPassword} required>
<input <div style={{ position: 'relative', width: '100%' }}>
id="reset-password" <input
type="password" id="reset-password"
required type={showPassword ? 'text' : 'password'}
minLength={8} required
value={password} minLength={8}
onChange={(e) => setPassword(e.target.value)} value={password}
placeholder="••••••••" onChange={(e) => setPassword(e.target.value)}
autoComplete="new-password" placeholder="••••••••"
style={{ autoComplete="new-password"
width: '100%', style={{
minHeight: '2.875rem', width: '100%',
padding: 'var(--space-3) var(--space-4)', minHeight: '2.875rem',
border: '1px solid var(--border-strong)', padding: 'var(--space-3) 2.5rem var(--space-3) var(--space-4)',
borderRadius: 'var(--radius-sm)', border: '1px solid var(--border-strong)',
background: 'var(--surface-primary)', borderRadius: 'var(--radius-sm)',
color: 'var(--text-primary)', background: 'var(--surface-primary)',
fontSize: '0.875rem', color: 'var(--text-primary)',
}} fontSize: '0.875rem',
/> }}
/>
<button
type="button"
onClick={() => setShowPassword((v) => !v)}
tabIndex={-1}
style={{
position: 'absolute',
top: 0,
bottom: 0,
right: '0.5rem',
display: 'flex',
alignItems: 'center',
background: 'none',
border: 'none',
cursor: 'pointer',
color: 'var(--text-tertiary)',
padding: 0,
}}
>
{showPassword ? (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</FormField> </FormField>
<FormField id="reset-confirm" label={dict.confirmPassword} required> <FormField id="reset-confirm" label={dict.confirmPassword} required>
<input <div style={{ position: 'relative', width: '100%' }}>
id="reset-confirm" <input
type="password" id="reset-confirm"
required type={showConfirm ? 'text' : 'password'}
minLength={8} required
value={confirm} minLength={8}
onChange={(e) => setConfirm(e.target.value)} value={confirm}
placeholder="••••••••" onChange={(e) => setConfirm(e.target.value)}
autoComplete="new-password" placeholder="••••••••"
style={{ autoComplete="new-password"
width: '100%', style={{
minHeight: '2.875rem', width: '100%',
padding: 'var(--space-3) var(--space-4)', minHeight: '2.875rem',
border: '1px solid var(--border-strong)', padding: 'var(--space-3) 2.5rem var(--space-3) var(--space-4)',
borderRadius: 'var(--radius-sm)', border: '1px solid var(--border-strong)',
background: 'var(--surface-primary)', borderRadius: 'var(--radius-sm)',
color: 'var(--text-primary)', background: 'var(--surface-primary)',
fontSize: '0.875rem', color: 'var(--text-primary)',
}} fontSize: '0.875rem',
/> }}
/>
<button
type="button"
onClick={() => setShowConfirm((v) => !v)}
tabIndex={-1}
style={{
position: 'absolute',
top: 0,
bottom: 0,
right: '0.5rem',
display: 'flex',
alignItems: 'center',
background: 'none',
border: 'none',
cursor: 'pointer',
color: 'var(--text-tertiary)',
padding: 0,
}}
>
{showConfirm ? (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</FormField> </FormField>
<Button type="submit" intent="primary" fullWidth loading={loading} disabled={loading}> <Button type="submit" intent="primary" fullWidth loading={loading} disabled={loading}>
@@ -104,6 +104,7 @@ export function SignInForm({ locale }: { locale: Locale }) {
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const [email, setEmail] = useState(''); const [email, setEmail] = useState('');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
const [totpCode, setTotpCode] = useState(''); const [totpCode, setTotpCode] = useState('');
const [step, setStep] = useState<'credentials' | 'totp'>('credentials'); const [step, setStep] = useState<'credentials' | 'totp'>('credentials');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@@ -271,25 +272,56 @@ export function SignInForm({ locale }: { locale: Locale }) {
</FormField> </FormField>
<FormField id="signin-password" label={dict.password} required> <FormField id="signin-password" label={dict.password} required>
<input <div style={{ position: 'relative', width: '100%' }}>
id="signin-password" <input
type="password" id="signin-password"
required type={showPassword ? 'text' : 'password'}
value={password} required
onChange={(e) => setPassword(e.target.value)} value={password}
placeholder="••••••••" onChange={(e) => setPassword(e.target.value)}
autoComplete="current-password" placeholder="••••••••"
style={{ autoComplete="current-password"
width: '100%', style={{
minHeight: '2.875rem', width: '100%',
padding: 'var(--space-3) var(--space-4)', minHeight: '2.875rem',
border: '1px solid var(--border-strong)', padding: 'var(--space-3) 2.5rem var(--space-3) var(--space-4)',
borderRadius: 'var(--radius-sm)', border: '1px solid var(--border-strong)',
background: 'var(--surface-primary)', borderRadius: 'var(--radius-sm)',
color: 'var(--text-primary)', background: 'var(--surface-primary)',
fontSize: '0.875rem', color: 'var(--text-primary)',
}} fontSize: '0.875rem',
/> }}
/>
<button
type="button"
onClick={() => setShowPassword((v) => !v)}
tabIndex={-1}
style={{
position: 'absolute',
top: 0,
bottom: 0,
right: '0.5rem',
display: 'flex',
alignItems: 'center',
background: 'none',
border: 'none',
cursor: 'pointer',
color: 'var(--text-tertiary)',
padding: 0,
}}
>
{showPassword ? (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
</FormField> </FormField>
<Button type="submit" intent="primary" fullWidth loading={loading} disabled={loading}> <Button type="submit" intent="primary" fullWidth loading={loading} disabled={loading}>