password_hash => password (display string); formatting

This commit is contained in:
Rob Colbert 2026-05-08 11:51:52 -04:00
parent 49ef6de30c
commit 2613acf00d

View File

@ -1,27 +1,30 @@
import { useState } from 'react';
import { Link } from 'react-router-dom';
import { api, AuthResponse, User } from '../lib/api';
import GadgetGrid from '../components/GadgetGrid';
import { useState } from "react";
import { Link } from "react-router-dom";
import { api, AuthResponse, User } from "../lib/api";
import GadgetGrid from "../components/GadgetGrid";
interface SignInProps {
onSuccess: (user: User, token: string) => void;
}
export default function SignIn({ onSuccess }: SignInProps) {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [error, setError] = useState('');
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState("");
const [loading, setLoading] = useState(false);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
setError('');
setError("");
setLoading(true);
try {
const response = await api.post<AuthResponse>('/auth/sign-in', { email, password });
const response = await api.post<AuthResponse>("/auth/sign-in", {
email,
password,
});
onSuccess(response.user, response.token);
} catch (err) {
setError(err instanceof Error ? err.message : 'Invalid credentials');
setError(err instanceof Error ? err.message : "Invalid credentials");
} finally {
setLoading(false);
}
@ -36,11 +39,14 @@ export default function SignIn({ onSuccess }: SignInProps) {
<div className="w-full max-w-md">
<div className="border-2 border-border-default p-6 rounded bg-bg-secondary">
<div className="font-mono text-text-secondary text-sm">
<div className="mb-1 text-text-muted">// AUTHENTICATION REQUIRED</div>
<div className="mb-1 text-text-muted">
// AUTHENTICATION REQUIRED
</div>
<div className="mb-6 text-text-primary">SYSTEM ACCESS</div>
<div className="text-text-muted mb-6">
Accounts are administered. Contact your administrator for access.
Accounts are administered. Contact your administrator for
access.
</div>
{error && (
@ -54,7 +60,10 @@ export default function SignIn({ onSuccess }: SignInProps) {
<form onSubmit={handleSubmit} className="space-y-4">
<div>
<label htmlFor="email" className="block text-sm text-text-muted mb-1 font-mono">
<label
htmlFor="email"
className="block text-sm text-text-muted mb-1 font-mono"
>
email_address
</label>
<input
@ -68,8 +77,11 @@ export default function SignIn({ onSuccess }: SignInProps) {
/>
</div>
<div>
<label htmlFor="password" className="block text-sm text-text-muted mb-1 font-mono">
password_hash
<label
htmlFor="password"
className="block text-sm text-text-muted mb-1 font-mono"
>
password
</label>
<input
id="password"
@ -93,7 +105,7 @@ export default function SignIn({ onSuccess }: SignInProps) {
disabled={loading}
className="flex-1 px-4 py-2 bg-brand hover:bg-red-700 text-white rounded transition-colors disabled:opacity-50 font-mono text-sm"
>
{loading ? 'VERIFYING...' : 'AUTHENTICATE'}
{loading ? "VERIFYING..." : "AUTHENTICATE"}
</button>
</div>
</form>