pages/Login¶
Remarks¶
Renders the login page. Authenticates via useAuth.
Features:
Username & password input fields
Calls the AuthContext
loginUser
to authenticateHandles both success and error flows:
If user is verified → navigate to /chat
If user is NOT verified → resend code & redirect to /register
If authentication fails → display error message
Resets username/password fields on error
Uses TailwindCSS for styling
Behavior:
Success + verified → redirect
/chat
Success + unverified → resend code & redirect
/register
Failure → show error
Uses TailwindCSS for styling.
Dependencies:
useAuth (AuthContext)
react-router-dom (navigation)
Example¶
import Login from './pages/Login';
<Route path="/login" element={<Login />} />
Functions¶
References¶
default¶
Renames and re-exports Login