diff --git a/apps/hackathon/src/app/auth/login/page.tsx b/apps/hackathon/src/app/auth/login/page.tsx index 081d5e2..1500130 100644 --- a/apps/hackathon/src/app/auth/login/page.tsx +++ b/apps/hackathon/src/app/auth/login/page.tsx @@ -17,6 +17,7 @@ export default function LoginPage() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(null); + const [showPassword, setShowPassword] = useState(false); const handleEmailLogin = async (e: React.FormEvent) => { e.preventDefault(); @@ -128,16 +129,25 @@ export default function LoginPage() { Forgot password? - setPassword(e.target.value)} - placeholder="••••••••" - disabled={loginMutation.isPending} - className="w-full px-4 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 disabled:cursor-not-allowed" - required - /> +
+ setPassword(e.target.value)} + placeholder="••••••••" + disabled={loginMutation.isPending} + className="w-full px-4 py-2.5 pr-12 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-500 disabled:bg-gray-100 dark:disabled:bg-gray-700 disabled:cursor-not-allowed" + required + /> + +
+
@@ -111,17 +125,26 @@ export default function ResetPasswordPage() { > Confirm New Password - setConfirmPassword(e.target.value)} - placeholder="••••••••" - disabled={resetPasswordMutation.isPending} - className="w-full px-4 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed bg-white dark:bg-gray-800 text-gray-900 dark:text-white" - required - minLength={6} - /> +
+ setConfirmPassword(e.target.value)} + placeholder="••••••••" + disabled={resetPasswordMutation.isPending} + className="w-full px-4 py-2.5 pr-12 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed bg-white dark:bg-gray-800 text-gray-900 dark:text-white" + required + minLength={6} + /> + +
+ {errors.password && (

{errors.password.message} @@ -253,16 +264,25 @@ export default function SignupPage() { > Confirm Password - +

+ + +
{errors.confirmPassword && (

{errors.confirmPassword.message} diff --git a/libs/service/src/api/hackathon.ts b/libs/service/src/api/hackathon.ts index 9b89a7d..29a2cfa 100644 --- a/libs/service/src/api/hackathon.ts +++ b/libs/service/src/api/hackathon.ts @@ -31,10 +31,16 @@ hackathonApi.interceptors.response.use( (response) => response, (error) => { // Handle 401 - clear session and redirect to login + // But skip redirect if already on auth pages (to avoid reload on login failure) if (error.response?.status === 401) { - useAuthStore.getState().clearSession(); - if (typeof window !== 'undefined') { - window.location.href = '/auth/login'; + const isAuthPage = globalThis.window !== undefined && globalThis.location.pathname.startsWith('/auth'); + + // Only clear session and redirect if not on auth page + if (!isAuthPage) { + useAuthStore.getState().clearSession(); + if (globalThis.window !== undefined) { + globalThis.location.href = '/auth/login'; + } } }