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
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ This project is configured with a professional CI/CD pipeline to ensure code qua

- **Continuous Deployment (CD)**: Handled by Vercel. Every successful push to the main branch is automatically built and deployed to the live environment with zero downtime.

## Test Credentials
- Email-test12@gmail.com
- Password= test12@2003

## Maintainer Contact
- Email - beesoul98012@gmail.com
90 changes: 89 additions & 1 deletion src/components/auth/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { signIn } from "next-auth/react"
import { useRouter } from "next/navigation"
import { Loader2 } from "lucide-react"
import { Loader2, Copy, Check } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
Form,
Expand Down Expand Up @@ -48,6 +48,42 @@ export default function LoginForm({ defaultCredentials }: LoginFormProps) {
},
})

// Test credentials for quick access in the login modal
const testEmail = "test12@gmail.com"
const testPassword = "test12@2003"
const [copiedEmail, setCopiedEmail] = useState(false)
const [copiedPassword, setCopiedPassword] = useState(false)

const copyToClipboard = async (text: string, type: 'email' | 'password') => {
try {
await navigator.clipboard.writeText(text)
if (type === 'email') {
setCopiedEmail(true)
setTimeout(() => setCopiedEmail(false), 2000)
} else {
setCopiedPassword(true)
setTimeout(() => setCopiedPassword(false), 2000)
}

toast({
title: 'Copied!',
description: `${type === 'email' ? 'Email' : 'Password'} copied to clipboard`,
})
} catch {
toast({
variant: 'destructive',
title: 'Failed to copy',
description: 'Please copy manually',
})
}
}

const handleAutoFillLocal = () => {
form.setValue('email', testEmail)
form.setValue('password', testPassword)
toast({ title: 'Credentials filled', description: 'Test credentials have been auto-filled' })
}

// Auto-fill credentials when provided from test credentials popup
useEffect(() => {
if (defaultCredentials) {
Expand Down Expand Up @@ -168,6 +204,58 @@ export default function LoginForm({ defaultCredentials }: LoginFormProps) {
"Login"
)}
</Button>

{/* Inline test credentials for quick access */}
<div className="mt-4 space-y-3">
<div className="flex items-center justify-between text-sm text-muted-foreground">
<span>Test credentials</span>
<button
type="button"
className="text-xs text-primary underline"
onClick={handleAutoFillLocal}
>
Auto-fill
</button>
</div>

<div className="grid grid-cols-1 gap-2">
<div className="border rounded-lg p-3 bg-muted/50 flex items-center justify-between">
<div>
<div className="text-xs text-muted-foreground">Email</div>
<div className="text-sm font-mono font-semibold">{testEmail}</div>
</div>
<button
type="button"
className="h-8 w-8 p-0"
onClick={() => copyToClipboard(testEmail, 'email')}
>
{copiedEmail ? (
<Check className="h-4 w-4 text-green-500" />
) : (
<Copy className="h-4 w-4" />
)}
</button>
</div>

<div className="border rounded-lg p-3 bg-muted/50 flex items-center justify-between">
<div>
<div className="text-xs text-muted-foreground">Password</div>
<div className="text-sm font-mono font-semibold">{testPassword}</div>
</div>
<button
type="button"
className="h-8 w-8 p-0"
onClick={() => copyToClipboard(testPassword, 'password')}
>
{copiedPassword ? (
<Check className="h-4 w-4 text-green-500" />
) : (
<Copy className="h-4 w-4" />
)}
</button>
</div>
</div>
</div>
</form>
</Form>
</div>
Expand Down
Loading