mirror of
https://github.com/johndoe6345789/docker-swarm-termina.git
synced 2026-04-24 13:45:01 +00:00
The e2e tests were failing because: 1. Button text was "Access Dashboard" but tests expected "Sign In" 2. Heading text was "Container Shell" but tests expected "Sign In" Changes: - Updated heading from "Container Shell" to "Sign In" - Updated button text from "Access Dashboard" to "Sign In" - Updated loading state text to "Signing in..." for consistency This fixes the failing tests in login.spec.ts and terminal.spec.ts that were unable to find the sign in button. https://claude.ai/code/session_01T57NPQfoRb2fS7ihdWkTxq
136 lines
3.4 KiB
TypeScript
136 lines
3.4 KiB
TypeScript
'use client';
|
|
|
|
import React from 'react';
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
TextField,
|
|
Button,
|
|
Typography,
|
|
Box,
|
|
Alert,
|
|
} from '@mui/material';
|
|
import { LockOpen } from '@mui/icons-material';
|
|
import { useLoginForm } from '@/lib/hooks/useLoginForm';
|
|
|
|
export default function LoginForm() {
|
|
const {
|
|
username,
|
|
setUsername,
|
|
password,
|
|
setPassword,
|
|
isShaking,
|
|
error,
|
|
loading,
|
|
handleSubmit,
|
|
} = useLoginForm();
|
|
|
|
return (
|
|
<Box
|
|
sx={{
|
|
minHeight: '100vh',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
background: 'linear-gradient(135deg, #1a202c 0%, #2d3748 100%)',
|
|
padding: 2,
|
|
}}
|
|
>
|
|
<Card
|
|
sx={{
|
|
width: '100%',
|
|
maxWidth: 400,
|
|
animation: isShaking ? 'shake 0.5s' : 'none',
|
|
'@keyframes shake': {
|
|
'0%, 100%': { transform: 'translateX(0)' },
|
|
'25%': { transform: 'translateX(-10px)' },
|
|
'75%': { transform: 'translateX(10px)' },
|
|
},
|
|
}}
|
|
>
|
|
<CardContent sx={{ p: 4 }}>
|
|
<Box sx={{ textAlign: 'center', mb: 4 }}>
|
|
<Box
|
|
sx={{
|
|
width: 64,
|
|
height: 64,
|
|
margin: '0 auto 16px',
|
|
background: 'rgba(56, 178, 172, 0.1)',
|
|
borderRadius: '8px',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
}}
|
|
>
|
|
<LockOpen sx={{ fontSize: 32, color: 'secondary.main' }} />
|
|
</Box>
|
|
<Typography variant="h1" component="h1" gutterBottom>
|
|
Sign In
|
|
</Typography>
|
|
<Typography variant="body2" color="text.secondary">
|
|
Enter your credentials to access the dashboard
|
|
</Typography>
|
|
</Box>
|
|
|
|
{error && (
|
|
<Alert severity="error" sx={{ mb: 2 }}>
|
|
{error}
|
|
</Alert>
|
|
)}
|
|
|
|
<form onSubmit={handleSubmit}>
|
|
<TextField
|
|
fullWidth
|
|
label="Username"
|
|
value={username}
|
|
onChange={(e) => setUsername(e.target.value)}
|
|
margin="normal"
|
|
required
|
|
autoComplete="username"
|
|
sx={{ mb: 2 }}
|
|
/>
|
|
|
|
<TextField
|
|
fullWidth
|
|
label="Password"
|
|
type="password"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
margin="normal"
|
|
required
|
|
autoComplete="current-password"
|
|
sx={{ mb: 3 }}
|
|
/>
|
|
|
|
<Button
|
|
type="submit"
|
|
fullWidth
|
|
variant="contained"
|
|
color="secondary"
|
|
size="large"
|
|
sx={{ mb: 2 }}
|
|
disabled={loading}
|
|
>
|
|
{loading ? 'Signing in...' : 'Sign In'}
|
|
</Button>
|
|
|
|
<Typography
|
|
variant="caption"
|
|
color="text.secondary"
|
|
sx={{
|
|
display: 'block',
|
|
textAlign: 'center',
|
|
pt: 2,
|
|
borderTop: 1,
|
|
borderColor: 'divider',
|
|
}}
|
|
>
|
|
Default: admin / admin123
|
|
</Typography>
|
|
</form>
|
|
</CardContent>
|
|
</Card>
|
|
</Box>
|
|
);
|
|
}
|