feat(auth): implement multi-step authentication flow with UI
This commit replaces the placeholder login page with a comprehensive, multi-step authentication system. It introduces a new `AuthPage` that orchestrates the user flow between login, signup, and OTP verification.
- **Login Form**: Supports both email and WhatsApp credentials, with input validation and API integration.
- **Signup Form**: Includes fields for full name, email, and WhatsApp, with real-time password strength validation.
- **OTP Form**: Provides a view for users to verify their account after signup.
- **UI/UX**: The entire authentication experience is restyled with a new background, Poppins font, custom brand colors, and improved form components for a polished look and feel.
- **Dependencies**: Adds `axios` for handling API requests to the backend.
BREAKING CHANGE: The `LoginPage` component has been deleted and is replaced by the new `AuthPage` component. All references to `LoginPage` must be updated.
2025-08-02 15:26:12 +07:00
|
|
|
import React, { useState, useCallback } from 'react';
|
|
|
|
|
import LoginForm from './LoginForm';
|
|
|
|
|
import SignupForm from './SignupForm';
|
|
|
|
|
import OtpForm from './OtpForm';
|
2025-08-02 16:32:07 +07:00
|
|
|
import ForgotPasswordForm from './ForgotPasswordForm';
|
|
|
|
|
import ResetPasswordForm from './ResetPasswordForm';
|
feat(auth): implement multi-step authentication flow with UI
This commit replaces the placeholder login page with a comprehensive, multi-step authentication system. It introduces a new `AuthPage` that orchestrates the user flow between login, signup, and OTP verification.
- **Login Form**: Supports both email and WhatsApp credentials, with input validation and API integration.
- **Signup Form**: Includes fields for full name, email, and WhatsApp, with real-time password strength validation.
- **OTP Form**: Provides a view for users to verify their account after signup.
- **UI/UX**: The entire authentication experience is restyled with a new background, Poppins font, custom brand colors, and improved form components for a polished look and feel.
- **Dependencies**: Adds `axios` for handling API requests to the backend.
BREAKING CHANGE: The `LoginPage` component has been deleted and is replaced by the new `AuthPage` component. All references to `LoginPage` must be updated.
2025-08-02 15:26:12 +07:00
|
|
|
|
|
|
|
|
const AuthPage = () => {
|
2025-08-02 16:32:07 +07:00
|
|
|
const [view, setView] = useState('login'); // 'login', 'signup', 'otp', 'forgotPassword', 'resetPassword'
|
feat(auth): implement multi-step authentication flow with UI
This commit replaces the placeholder login page with a comprehensive, multi-step authentication system. It introduces a new `AuthPage` that orchestrates the user flow between login, signup, and OTP verification.
- **Login Form**: Supports both email and WhatsApp credentials, with input validation and API integration.
- **Signup Form**: Includes fields for full name, email, and WhatsApp, with real-time password strength validation.
- **OTP Form**: Provides a view for users to verify their account after signup.
- **UI/UX**: The entire authentication experience is restyled with a new background, Poppins font, custom brand colors, and improved form components for a polished look and feel.
- **Dependencies**: Adds `axios` for handling API requests to the backend.
BREAKING CHANGE: The `LoginPage` component has been deleted and is replaced by the new `AuthPage` component. All references to `LoginPage` must be updated.
2025-08-02 15:26:12 +07:00
|
|
|
|
|
|
|
|
const showSignup = useCallback(() => setView('signup'), []);
|
|
|
|
|
const showLogin = useCallback(() => setView('login'), []);
|
|
|
|
|
const showOtp = useCallback(() => setView('otp'), []);
|
2025-08-02 16:32:07 +07:00
|
|
|
const showForgotPassword = useCallback(() => setView('forgotPassword'), []);
|
|
|
|
|
const showResetPassword = useCallback(() => setView('resetPassword'), []);
|
feat(auth): implement multi-step authentication flow with UI
This commit replaces the placeholder login page with a comprehensive, multi-step authentication system. It introduces a new `AuthPage` that orchestrates the user flow between login, signup, and OTP verification.
- **Login Form**: Supports both email and WhatsApp credentials, with input validation and API integration.
- **Signup Form**: Includes fields for full name, email, and WhatsApp, with real-time password strength validation.
- **OTP Form**: Provides a view for users to verify their account after signup.
- **UI/UX**: The entire authentication experience is restyled with a new background, Poppins font, custom brand colors, and improved form components for a polished look and feel.
- **Dependencies**: Adds `axios` for handling API requests to the backend.
BREAKING CHANGE: The `LoginPage` component has been deleted and is replaced by the new `AuthPage` component. All references to `LoginPage` must be updated.
2025-08-02 15:26:12 +07:00
|
|
|
|
|
|
|
|
const renderForm = () => {
|
|
|
|
|
switch (view) {
|
|
|
|
|
case 'signup':
|
|
|
|
|
return <SignupForm toggleForm={showLogin} onSuccess={showOtp} />;
|
|
|
|
|
case 'otp':
|
2025-08-02 16:32:07 +07:00
|
|
|
return <OtpForm onSuccess={showLogin} />;
|
|
|
|
|
case 'forgotPassword':
|
|
|
|
|
return <ForgotPasswordForm showLogin={showLogin} showReset={showResetPassword} />;
|
|
|
|
|
case 'resetPassword':
|
|
|
|
|
return <ResetPasswordForm showLogin={showLogin} />;
|
feat(auth): implement multi-step authentication flow with UI
This commit replaces the placeholder login page with a comprehensive, multi-step authentication system. It introduces a new `AuthPage` that orchestrates the user flow between login, signup, and OTP verification.
- **Login Form**: Supports both email and WhatsApp credentials, with input validation and API integration.
- **Signup Form**: Includes fields for full name, email, and WhatsApp, with real-time password strength validation.
- **OTP Form**: Provides a view for users to verify their account after signup.
- **UI/UX**: The entire authentication experience is restyled with a new background, Poppins font, custom brand colors, and improved form components for a polished look and feel.
- **Dependencies**: Adds `axios` for handling API requests to the backend.
BREAKING CHANGE: The `LoginPage` component has been deleted and is replaced by the new `AuthPage` component. All references to `LoginPage` must be updated.
2025-08-02 15:26:12 +07:00
|
|
|
case 'login':
|
|
|
|
|
default:
|
2025-08-02 16:32:07 +07:00
|
|
|
return <LoginForm toggleForm={showSignup} showForgotPassword={showForgotPassword} />;
|
feat(auth): implement multi-step authentication flow with UI
This commit replaces the placeholder login page with a comprehensive, multi-step authentication system. It introduces a new `AuthPage` that orchestrates the user flow between login, signup, and OTP verification.
- **Login Form**: Supports both email and WhatsApp credentials, with input validation and API integration.
- **Signup Form**: Includes fields for full name, email, and WhatsApp, with real-time password strength validation.
- **OTP Form**: Provides a view for users to verify their account after signup.
- **UI/UX**: The entire authentication experience is restyled with a new background, Poppins font, custom brand colors, and improved form components for a polished look and feel.
- **Dependencies**: Adds `axios` for handling API requests to the backend.
BREAKING CHANGE: The `LoginPage` component has been deleted and is replaced by the new `AuthPage` component. All references to `LoginPage` must be updated.
2025-08-02 15:26:12 +07:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen flex items-center justify-center p-4">
|
|
|
|
|
<div className="w-full max-w-md p-8 space-y-6 bg-black/30 backdrop-blur-xl rounded-2xl shadow-2xl">
|
|
|
|
|
{renderForm()}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default AuthPage;
|