Added email domain restriction and error popup toast

This commit is contained in:
arav
2026-01-08 23:44:21 +05:30
parent 91a3f95a0a
commit 6cc3e4a086
5 changed files with 56 additions and 7 deletions

View File

@@ -1,4 +1,6 @@
import { Button } from '@workspace/ui/components/button';
import { Alert, AlertDescription, AlertTitle } from '@workspace/ui/components/alert';
import { AlertCircle } from 'lucide-react';
import { signIn } from '@/auth';
async function logIn() {
@@ -6,7 +8,10 @@ async function logIn() {
await signIn('google', { redirectTo: '/' });
}
export default async function Page() {
// export default async function Page() {
export default async function Page(props: { searchParams: Promise<{ error?: string }> }) {
const searchParams = await props.searchParams;
const error = searchParams?.error;
return (
<div className="relative min-h-svh flex items-center justify-center overflow-hidden bg-gradient-to-br from-blue-100 via-red-100 to-pink-100 transition-colors duration-500">
{/* Animated floating shapes */}
@@ -23,6 +28,17 @@ export default async function Page() {
<p className="text-gray-500 text-sm text-center">Sign in to manage your placements</p>
<p className="text-xs text-red-500 font-semibold italic mt-1 animate-fade-in">Empower your journey. Shape the future.</p>
</div>
{error === 'AccessDenied' && (
<Alert variant="destructive" className="animate-in fade-in slide-in-from-top-4 duration-300">
<AlertCircle className="h-4 w-4" />
<AlertTitle>Access Denied</AlertTitle>
<AlertDescription>
Please sign in with your somaiya email ID.
</AlertDescription>
</Alert>
)}
<form action={logIn} className="w-full">
<Button type="submit" variant="outline" className="w-full h-12 relative overflow-hidden group rounded-lg shadow-md hover:shadow-lg transition-all focus:ring-2 focus:ring-red-400">
<span className="absolute inset-0 bg-gradient-to-r from-red-200/0 via-red-200/20 to-red-200/0 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 ease-out pointer-events-none" />