@thetechfossil/auth2 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +218 -0
- package/dist/index.components.d.ts +62 -0
- package/dist/index.components.js +1757 -0
- package/dist/index.components.js.map +1 -0
- package/dist/index.components.mjs +1747 -0
- package/dist/index.components.mjs.map +1 -0
- package/dist/index.d.ts +228 -0
- package/dist/index.js +1853 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1844 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.next.d.ts +232 -0
- package/dist/index.next.js +2093 -0
- package/dist/index.next.js.map +1 -0
- package/dist/index.next.mjs +2078 -0
- package/dist/index.next.mjs.map +1 -0
- package/dist/index.next.server.d.ts +142 -0
- package/dist/index.next.server.js +442 -0
- package/dist/index.next.server.js.map +1 -0
- package/dist/index.next.server.mjs +433 -0
- package/dist/index.next.server.mjs.map +1 -0
- package/dist/index.node.d.ts +133 -0
- package/dist/index.node.js +381 -0
- package/dist/index.node.js.map +1 -0
- package/dist/index.node.mjs +373 -0
- package/dist/index.node.mjs.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/components/LoginForm.tsx","../src/react/use-auth.ts","../src/core/http-client.ts","../src/core/auth-service.ts","../src/react/components/RegisterForm.tsx","../src/react/components/OtpForm.tsx","../src/react/components/AuthFlow.tsx","../src/react/components/EmailVerificationPage.tsx"],"names":["useState","jsx","jsxs","email","useEffect"],"mappings":";AAEA,SAAgB,YAAAA,iBAAgB;;;ACFhC,SAAS,UAAU,WAAW,mBAAmB;;;ACAjD,OAAO,WAA8D;AAE9D,IAAM,aAAN,MAAiB;AAAA,EAItB,YAAY,SAAiB,iBAAyC,CAAC,GAAG;AAF1E,SAAQ,YAA2B;AAGjC,SAAK,gBAAgB,MAAM,OAAO;AAAA,MAChC,SAAS,QAAQ,QAAQ,OAAO,EAAE;AAAA,MAClC,SA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A,YACL,SAAS;AAAA,YACT,iBAAiB;AAAA,YACjB,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,UAAU;AAAA,YACV,YAAY;AAAA,YACZ,QAAQ;AAAA,YACR,YAAY;AAAA,UACd;AAAA,UACD;AAAA;AAAA,MAED;AAAA,OACF;AAAA,KAEJ,GACF;AAEJ","sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { useAuth } from '../use-auth';\n// Removed CSS import - styles will be embedded directly\n\ninterface LoginFormProps {\n onSuccess?: (response: { message: string; email?: string; token?: string; success: boolean; user?: any }) => void;\n onLoginSuccess?: (email: string, needsOtpVerification: boolean) => void; // For backward compatibility\n onRegisterClick?: () => void;\n showRegisterLink?: boolean;\n config?: {\n baseUrl?: string;\n };\n oauthProviders?: Array<'google' | 'github'>;\n showOAuthButtons?: boolean;\n}\n\nexport const LoginForm: React.FC<LoginFormProps> = ({\n onSuccess,\n onLoginSuccess,\n onRegisterClick,\n showRegisterLink = true,\n config,\n oauthProviders = ['google', 'github'],\n showOAuthButtons = true\n}) => {\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [usePassword, setUsePassword] = useState(false);\n const [showPassword, setShowPassword] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [rememberMe, setRememberMe] = useState(false);\n\n const { login } = useAuth({\n baseUrl: config?.baseUrl || (typeof window !== 'undefined' ? window.location.origin : 'http://localhost:7000')\n });\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setIsLoading(true);\n setError(null);\n\n try {\n let response;\n if (usePassword) {\n // Traditional email/password login\n response = await login({ email, password });\n } else {\n // OTP-based login\n response = await login({ email });\n }\n\n if (response.success) {\n // Call the new callback if provided\n onSuccess?.(response);\n\n // For backward compatibility, call the old callback if provided\n if (onLoginSuccess) {\n // Check if this is an OTP sent response or a successful login\n if (response.message === 'OTP sent to your email.') {\n // OTP was sent, need to verify\n onLoginSuccess(email, true);\n } else if (response.token) {\n // Direct login successful (email/password)\n onLoginSuccess(email, false);\n } else {\n // Default to needing OTP verification for safety\n onLoginSuccess(email, true);\n }\n }\n } else {\n setError(response.message || 'Login failed');\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : 'An unknown error occurred');\n } finally {\n setIsLoading(false);\n }\n };\n\n const toggleAuthMethod = () => {\n setUsePassword(!usePassword);\n setError(null); // Clear error when switching methods\n };\n\n const togglePasswordVisibility = () => {\n setShowPassword(!showPassword);\n };\n\n return (\n <div style={{\n maxWidth: '400px',\n margin: '0 auto',\n padding: '30px',\n borderRadius: '12px',\n boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)',\n backgroundColor: '#ffffff',\n border: '1px solid #eaeaea'\n }}>\n <form onSubmit={handleSubmit} style={{\n display: 'flex',\n flexDirection: 'column'\n }}>\n <h2 style={{\n textAlign: 'center',\n marginBottom: '24px',\n color: '#1f2937',\n fontSize: '24px',\n fontWeight: 600\n }}>{usePassword ? 'Login with Password' : 'Login with OTP'}</h2>\n\n {error && (\n <div style={{\n padding: '12px 16px',\n marginBottom: '20px',\n backgroundColor: '#f8d7da',\n color: '#721c24',\n border: '1px solid #f5c6cb',\n borderRadius: '8px',\n fontSize: '14px',\n fontWeight: 500\n }}>\n {error}\n </div>\n )}\n\n <div style={{\n marginBottom: '20px'\n }}>\n <label htmlFor=\"email\" style={{\n display: 'block',\n marginBottom: '8px',\n fontWeight: 500,\n color: '#374151',\n fontSize: '14px'\n }}>Email:</label>\n <input\n id=\"email\"\n type=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n required\n disabled={isLoading}\n style={{\n width: '100%',\n padding: '12px 16px',\n border: '1px solid #ddd',\n borderRadius: '8px',\n fontSize: '16px',\n boxSizing: 'border-box',\n color: '#111827',\n transition: 'all 0.2s ease',\n backgroundColor: '#ffffff'\n }}\n placeholder=\"Enter your email\"\n />\n </div>\n\n {usePassword && (\n <div style={{\n marginBottom: '20px',\n position: 'relative'\n }}>\n <label htmlFor=\"login-password\" style={{\n display: 'block',\n marginBottom: '8px',\n fontWeight: 500,\n color: '#555',\n fontSize: '14px'\n }}>Password:</label>\n <input\n id=\"login-password\"\n type={showPassword ? \"text\" : \"password\"}\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n required\n disabled={isLoading}\n style={{\n width: '100%',\n padding: '12px 16px',\n border: '1px solid #ddd',\n borderRadius: '8px',\n fontSize: '16px',\n boxSizing: 'border-box',\n color: '#333',\n transition: 'all 0.2s ease',\n backgroundColor: '#fafafa'\n }}\n placeholder=\"Enter your password\"\n />\n <button\n type=\"button\"\n onClick={togglePasswordVisibility}\n disabled={isLoading}\n style={{\n position: 'absolute',\n right: '12px',\n top: '38px',\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n color: '#666',\n fontSize: '14px'\n }}\n >\n {showPassword ? 'Hide' : 'Show'}\n </button>\n </div>\n )}\n\n {usePassword && (\n <div style={{\n display: 'flex',\n alignItems: 'center',\n marginBottom: '16px',\n marginTop: '8px'\n }}>\n <input\n type=\"checkbox\"\n id=\"remember-me\"\n checked={rememberMe}\n onChange={(e) => setRememberMe(e.target.checked)}\n disabled={isLoading}\n style={{\n marginRight: '8px',\n cursor: 'pointer',\n width: '16px',\n height: '16px'\n }}\n />\n <label\n htmlFor=\"remember-me\"\n style={{\n fontSize: '14px',\n color: '#666',\n cursor: 'pointer',\n userSelect: 'none'\n }}\n >\n Remember me\n </label>\n </div>\n )}\n\n <button\n type=\"submit\"\n disabled={isLoading}\n style={{\n padding: '14px',\n backgroundColor: '#007bff',\n color: 'white',\n border: 'none',\n borderRadius: '8px',\n fontSize: '16px',\n fontWeight: 600,\n cursor: 'pointer',\n transition: 'all 0.2s ease',\n marginTop: '8px'\n }}\n >\n {isLoading ? (usePassword ? 'Logging in...' : 'Sending OTP...') : (usePassword ? 'Login' : 'Send OTP')}\n </button>\n\n <div style={{\n textAlign: 'center',\n marginTop: '20px',\n paddingTop: '20px',\n borderTop: '1px solid #eee'\n }}>\n <button\n type=\"button\"\n onClick={toggleAuthMethod}\n disabled={isLoading}\n style={{\n background: 'none',\n border: 'none',\n color: '#007bff',\n textDecoration: 'none',\n cursor: 'pointer',\n fontSize: '14px',\n fontWeight: 600,\n padding: '0',\n transition: 'color 0.2s ease'\n }}\n >\n {usePassword ? 'Login with OTP instead' : 'Login with password instead'}\n </button>\n </div>\n\n {showOAuthButtons && oauthProviders.length > 0 && (\n <div style={{\n marginTop: '20px',\n paddingTop: '20px',\n borderTop: '1px solid #eee'\n }}>\n <div style={{\n position: 'relative',\n marginBottom: '16px'\n }}>\n <div style={{\n position: 'absolute',\n top: '50%',\n left: 0,\n right: 0,\n height: '1px',\n backgroundColor: '#eee'\n }} />\n <div style={{\n position: 'relative',\n textAlign: 'center'\n }}>\n <span style={{\n backgroundColor: '#ffffff',\n padding: '0 12px',\n color: '#666',\n fontSize: '14px'\n }}>Or continue with</span>\n </div>\n </div>\n\n <div style={{\n display: 'grid',\n gridTemplateColumns: oauthProviders.length === 1 ? '1fr' : 'repeat(2, 1fr)',\n gap: '12px'\n }}>\n {oauthProviders.includes('google') && (\n <a\n href={`${config?.baseUrl || 'http://localhost:7000'}/api/v1/auth/oauth/google`}\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '8px',\n padding: '10px 16px',\n backgroundColor: '#ffffff',\n border: '1px solid #ddd',\n borderRadius: '8px',\n color: '#333',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n cursor: 'pointer',\n transition: 'all 0.2s ease'\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#f8f8f8';\n e.currentTarget.style.borderColor = '#007bff';\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#ffffff';\n e.currentTarget.style.borderColor = '#ddd';\n }}\n >\n <svg style={{ width: '18px', height: '18px' }} viewBox=\"0 0 24 24\">\n <path\n fill=\"#4285F4\"\n d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\"\n />\n <path\n fill=\"#EA4335\"\n d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\"\n />\n </svg>\n Google\n </a>\n )}\n\n {oauthProviders.includes('github') && (\n <a\n href={`${config?.baseUrl || 'http://localhost:7000'}/api/v1/auth/oauth/github`}\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '8px',\n padding: '10px 16px',\n backgroundColor: '#24292e',\n border: '1px solid #24292e',\n borderRadius: '8px',\n color: '#ffffff',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n cursor: 'pointer',\n transition: 'all 0.2s ease'\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#1b1f23';\n e.currentTarget.style.borderColor = '#1b1f23';\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#24292e';\n e.currentTarget.style.borderColor = '#24292e';\n }}\n >\n <svg style={{ width: '18px', height: '18px' }} fill=\"currentColor\" viewBox=\"0 0 24 24\">\n <path d=\"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z\" />\n </svg>\n GitHub\n </a>\n )}\n </div>\n </div>\n )}\n\n {showRegisterLink && (\n <div style={{\n textAlign: 'center',\n marginTop: '20px',\n paddingTop: '20px',\n borderTop: '1px solid #eee'\n }}>\n <p style={{\n color: '#666',\n fontSize: '14px'\n }}>\n Don't have an account?{' '}\n <button\n type=\"button\"\n onClick={onRegisterClick}\n disabled={isLoading}\n style={{\n background: 'none',\n border: 'none',\n color: '#007bff',\n textDecoration: 'none',\n cursor: 'pointer',\n fontSize: '14px',\n fontWeight: 600,\n padding: '0',\n transition: 'color 0.2s ease'\n }}\n >\n Register\n </button>\n </p>\n </div>\n )}\n </form>\n </div>\n );\n};","import { useState, useEffect, useCallback } from 'react';\r\nimport { AuthService } from '../core/auth-service';\r\nimport { \r\n AuthResponse, \r\n LoginData, \r\n VerifyData, \r\n UpdateUserData, \r\n User,\r\n AuthConfig,\r\n RegisterData\r\n} from '../types';\r\n\r\ninterface UseAuthReturnBase {\r\n user: User | null;\r\n isAuthenticated: boolean;\r\n loading: boolean;\r\n register: (data: RegisterData) => Promise<AuthResponse>;\r\n login: (data: LoginData) => Promise<AuthResponse>;\r\n verify: (data: VerifyData) => Promise<AuthResponse>;\r\n verifyEmailToken: (token: string) => Promise<AuthResponse>;\r\n logout: () => Promise<void>;\r\n updateProfile: (data: UpdateUserData) => Promise<AuthResponse>;\r\n getProfile: () => Promise<User>;\r\n getAllUsers: () => Promise<User[]>;\r\n getUserById: (id: string) => Promise<User>;\r\n}\r\n\r\nexport const useAuth = (config: AuthConfig): UseAuthReturnBase => {\r\n const [authService] = useState<AuthService>(() => new AuthService(config));\r\n const [user, setUser] = useState<User | null>(null);\r\n const [isAuthenticated, setIsAuthenticated] = useState<boolean>(false);\r\n const [loading, setLoading] = useState<boolean>(true);\r\n\r\n const checkAuthStatus = useCallback(() => {\r\n const authenticated = authService.isAuthenticated();\r\n setIsAuthenticated(authenticated);\r\n \r\n if (authenticated) {\r\n const currentUser = authService.getCurrentUser();\r\n setUser(currentUser);\r\n } else {\r\n setUser(null);\r\n }\r\n \r\n setLoading(false);\r\n }, [authService]);\r\n\r\n useEffect(() => {\r\n checkAuthStatus();\r\n }, [checkAuthStatus]);\r\n\r\n const register = useCallback(async (data: RegisterData): Promise<AuthResponse> => {\r\n setLoading(true);\r\n try {\r\n // Automatically add frontend base URL if not provided and we're on the client\r\n const registerData = { ...data };\r\n if (!registerData.frontendBaseUrl && typeof window !== 'undefined') {\r\n // Check for environment variable first, then fallback to window.location.origin\r\n registerData.frontendBaseUrl = \r\n process.env.REACT_APP_FRONTEND_BASE_URL || \r\n process.env.NEXT_PUBLIC_FRONTEND_BASE_URL || \r\n process.env.NEXT_PUBLIC_APP_URL || \r\n window.location.origin;\r\n }\r\n \r\n const response = await authService.register(registerData);\r\n return response;\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const login = useCallback(async (data: LoginData): Promise<AuthResponse> => {\r\n setLoading(true);\r\n try {\r\n const response = await authService.login(data);\r\n // Update user state if login was successful and we have a user\r\n if (response.success && response.user) {\r\n setUser(response.user);\r\n setIsAuthenticated(true);\r\n }\r\n return response;\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const verify = useCallback(async (data: VerifyData): Promise<AuthResponse> => {\r\n setLoading(true);\r\n try {\r\n const response = await authService.verify(data);\r\n if (response.success && response.user) {\r\n setUser(response.user);\r\n setIsAuthenticated(true);\r\n }\r\n return response;\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const verifyEmailToken = useCallback(async (token: string): Promise<AuthResponse> => {\r\n setLoading(true);\r\n try {\r\n const response = await authService.verifyEmailToken(token);\r\n if (response.success && response.user) {\r\n setUser(response.user);\r\n setIsAuthenticated(true);\r\n }\r\n return response;\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const logout = useCallback(async (): Promise<void> => {\r\n setLoading(true);\r\n try {\r\n await authService.logout();\r\n setUser(null);\r\n setIsAuthenticated(false);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const updateProfile = useCallback(async (data: UpdateUserData): Promise<AuthResponse> => {\r\n setLoading(true);\r\n try {\r\n const response = await authService.updateProfile(data);\r\n if (response.success && response.user) {\r\n setUser(response.user);\r\n }\r\n return response;\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const getProfile = useCallback(async (): Promise<User> => {\r\n setLoading(true);\r\n try {\r\n const userData = await authService.getProfile();\r\n setUser(userData);\r\n return userData;\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const getAllUsers = useCallback(async (): Promise<User[]> => {\r\n setLoading(true);\r\n try {\r\n return await authService.getAllUsers();\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n const getUserById = useCallback(async (id: string): Promise<User> => {\r\n setLoading(true);\r\n try {\r\n return await authService.getUserById(id);\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [authService]);\r\n\r\n return {\r\n user,\r\n isAuthenticated,\r\n loading,\r\n register,\r\n login,\r\n verify,\r\n verifyEmailToken,\r\n logout,\r\n updateProfile,\r\n getProfile,\r\n getAllUsers,\r\n getUserById\r\n };\r\n};","import axios, { AxiosInstance, AxiosRequestConfig, AxiosError } from 'axios';\r\n\r\nexport class HttpClient {\r\n private axiosInstance: AxiosInstance;\r\n private csrfToken: string | null = null;\r\n\r\n constructor(baseUrl: string, defaultHeaders: Record<string, string> = {}) {\r\n this.axiosInstance = axios.create({\r\n baseURL: baseUrl.replace(/\\/$/, ''),\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n ...defaultHeaders\r\n },\r\n withCredentials: true, // Include cookies for CSRF\r\n timeout: 30000 // 30 second timeout\r\n });\r\n\r\n // Request interceptor to add CSRF token\r\n this.axiosInstance.interceptors.request.use(\r\n (config) => {\r\n // Add CSRF token to mutating requests\r\n if (this.csrfToken && ['post', 'put', 'delete', 'patch'].includes(config.method?.toLowerCase() || '')) {\r\n config.headers['x-csrf-token'] = this.csrfToken;\r\n }\r\n return config;\r\n },\r\n (error) => Promise.reject(error)\r\n );\r\n\r\n // Response interceptor for error handling and CSRF token refresh\r\n this.axiosInstance.interceptors.response.use(\r\n (response) => response,\r\n async (error: AxiosError) => {\r\n const originalRequest = error.config as AxiosRequestConfig & { _retry?: boolean };\r\n\r\n // Handle CSRF token refresh on 403\r\n if (error.response?.status === 403 && !originalRequest._retry) {\r\n originalRequest._retry = true;\r\n\r\n try {\r\n await this.refreshCsrfToken();\r\n if (originalRequest.headers) {\r\n originalRequest.headers['x-csrf-token'] = this.csrfToken!;\r\n }\r\n return this.axiosInstance(originalRequest);\r\n } catch (refreshError) {\r\n return Promise.reject(refreshError);\r\n }\r\n }\r\n\r\n return Promise.reject(error);\r\n }\r\n );\r\n }\r\n\r\n public async get<T>(endpoint: string, headers?: Record<string, string>): Promise<T> {\r\n const response = await this.axiosInstance.get<T>(endpoint, { headers });\r\n return response.data;\r\n }\r\n\r\n public async post<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T> {\r\n const response = await this.axiosInstance.post<T>(endpoint, data, { headers });\r\n return response.data;\r\n }\r\n\r\n public async put<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T> {\r\n const response = await this.axiosInstance.put<T>(endpoint, data, { headers });\r\n return response.data;\r\n }\r\n\r\n public async delete<T>(endpoint: string, headers?: Record<string, string>): Promise<T> {\r\n const response = await this.axiosInstance.delete<T>(endpoint, { headers });\r\n return response.data;\r\n }\r\n\r\n public setAuthToken(token: string): void {\r\n this.axiosInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`;\r\n }\r\n\r\n public removeAuthToken(): void {\r\n delete this.axiosInstance.defaults.headers.common['Authorization'];\r\n }\r\n\r\n public setCsrfToken(token: string): void {\r\n this.csrfToken = token;\r\n }\r\n\r\n public getCsrfToken(): string | null {\r\n return this.csrfToken;\r\n }\r\n\r\n public removeCsrfToken(): void {\r\n this.csrfToken = null;\r\n }\r\n\r\n private async refreshCsrfToken(): Promise<void> {\r\n try {\r\n const response = await this.axiosInstance.get<{ csrfToken: string }>('/api/v1/auth/csrf-token');\r\n this.csrfToken = response.data.csrfToken;\r\n } catch (error) {\r\n console.error('Failed to refresh CSRF token:', error);\r\n throw error;\r\n }\r\n }\r\n}","import { HttpClient } from './http-client';\r\nimport {\r\n AuthResponse,\r\n LoginData,\r\n VerifyData,\r\n UpdateUserData,\r\n User,\r\n AuthConfig,\r\n RegisterData,\r\n OAuthProvider,\r\n CsrfTokenResponse\r\n} from '../types';\r\n\r\nexport class AuthService {\r\n private httpClient: HttpClient;\r\n private config: AuthConfig;\r\n private token: string | null = null;\r\n\r\n constructor(config: AuthConfig) {\r\n this.config = {\r\n localStorageKey: 'auth_token',\r\n csrfEnabled: true,\r\n ...config\r\n };\r\n\r\n this.httpClient = new HttpClient(this.config.baseUrl);\r\n this.loadTokenFromStorage();\r\n\r\n // Initialize CSRF token if enabled\r\n if (this.config.csrfEnabled && typeof window !== 'undefined') {\r\n this.refreshCsrfToken();\r\n }\r\n }\r\n\r\n private loadTokenFromStorage(): void {\r\n if (typeof window !== 'undefined' && this.config.localStorageKey) {\r\n try {\r\n const token = localStorage.getItem(this.config.localStorageKey);\r\n if (token) {\r\n this.token = token;\r\n this.httpClient.setAuthToken(token);\r\n }\r\n } catch (error) {\r\n console.warn('Failed to load token from storage:', error);\r\n }\r\n }\r\n }\r\n\r\n private saveTokenToStorage(token: string): void {\r\n if (typeof window !== 'undefined' && this.config.localStorageKey) {\r\n try {\r\n localStorage.setItem(this.config.localStorageKey, token);\r\n } catch (error) {\r\n console.warn('Failed to save token to storage:', error);\r\n }\r\n }\r\n }\r\n\r\n private removeTokenFromStorage(): void {\r\n if (typeof window !== 'undefined' && this.config.localStorageKey) {\r\n try {\r\n localStorage.removeItem(this.config.localStorageKey);\r\n } catch (error) {\r\n console.warn('Failed to remove token from storage:', error);\r\n }\r\n }\r\n }\r\n\r\n public isAuthenticated(): boolean {\r\n return !!this.token;\r\n }\r\n\r\n public getToken(): string | null {\r\n return this.token;\r\n }\r\n\r\n public getCurrentUser(): User | null {\r\n if (!this.token) return null;\r\n\r\n try {\r\n const payload = JSON.parse(atob(this.token.split('.')[1]));\r\n return payload.user || null;\r\n } catch (error) {\r\n console.error('Failed to parse user from token:', error);\r\n return null;\r\n }\r\n }\r\n\r\n // CSRF Token Management\r\n public async refreshCsrfToken(): Promise<void> {\r\n if (!this.config.csrfEnabled) return;\r\n\r\n try {\r\n const response = await this.httpClient.get<CsrfTokenResponse>('/api/v1/auth/csrf-token');\r\n if (response.csrfToken) {\r\n this.httpClient.setCsrfToken(response.csrfToken);\r\n }\r\n } catch (error) {\r\n console.error('Failed to get CSRF token:', error);\r\n }\r\n }\r\n\r\n public getCsrfToken(): string | null {\r\n return this.httpClient.getCsrfToken();\r\n }\r\n\r\n // OAuth Methods\r\n public loginWithOAuth(provider: OAuthProvider): void {\r\n if (typeof window === 'undefined') {\r\n throw new Error('OAuth login is only available in browser environments');\r\n }\r\n\r\n const oauthUrl = `${this.config.baseUrl}/api/v1/auth/oauth/${provider}`;\r\n window.location.href = oauthUrl;\r\n }\r\n\r\n public linkOAuthProvider(provider: OAuthProvider): void {\r\n if (typeof window === 'undefined') {\r\n throw new Error('OAuth linking is only available in browser environments');\r\n }\r\n\r\n if (!this.token) {\r\n throw new Error('Must be authenticated to link OAuth provider');\r\n }\r\n\r\n const linkUrl = `${this.config.baseUrl}/api/v1/auth/oauth/${provider}/link`;\r\n window.location.href = linkUrl;\r\n }\r\n\r\n public async unlinkOAuthProvider(provider: OAuthProvider): Promise<AuthResponse> {\r\n if (!this.token) {\r\n throw new Error('Not authenticated');\r\n }\r\n\r\n const response = await this.httpClient.delete<AuthResponse>(\r\n `/api/v1/auth/oauth/${provider}/unlink`\r\n );\r\n return response;\r\n }\r\n\r\n // Standard Auth Methods\r\n public async login(data: LoginData): Promise<AuthResponse> {\r\n const response = await this.httpClient.post<AuthResponse>('/api/v1/auth/login', data);\r\n\r\n if (response.success && response.token) {\r\n this.token = response.token;\r\n this.httpClient.setAuthToken(response.token);\r\n this.saveTokenToStorage(response.token);\r\n return response;\r\n }\r\n\r\n if (response.success && response.message === 'OTP sent to your email.') {\r\n return response;\r\n }\r\n\r\n if (response.success && response.message === 'OTP verified successfully.' && response.token) {\r\n this.token = response.token;\r\n this.httpClient.setAuthToken(response.token);\r\n this.saveTokenToStorage(response.token);\r\n return response;\r\n }\r\n\r\n throw new Error(response.message || 'Login failed');\r\n }\r\n\r\n public async register(data: RegisterData): Promise<AuthResponse> {\r\n const registerData = { ...data };\r\n if (!registerData.frontendBaseUrl && typeof window !== 'undefined') {\r\n registerData.frontendBaseUrl =\r\n process.env.FRONTEND_BASE_URL ||\r\n process.env.NEXT_PUBLIC_FRONTEND_BASE_URL ||\r\n process.env.REACT_APP_FRONTEND_BASE_URL ||\r\n process.env.NEXT_PUBLIC_APP_URL ||\r\n window.location.origin;\r\n }\r\n\r\n const response = await this.httpClient.post<AuthResponse>('/api/v1/auth/register', registerData);\r\n\r\n if (response.success && response.message === 'Registration data saved. Verification email sent. Please check your inbox.') {\r\n return response;\r\n }\r\n\r\n throw new Error(response.message || 'Registration failed');\r\n }\r\n\r\n public async verify(data: VerifyData): Promise<AuthResponse> {\r\n const response = await this.httpClient.post<AuthResponse>('/api/v1/auth/verify', data);\r\n\r\n if (response.success && response.token) {\r\n this.token = response.token;\r\n this.httpClient.setAuthToken(response.token);\r\n this.saveTokenToStorage(response.token);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n public async verifyEmailToken(token: string): Promise<AuthResponse> {\r\n const response = await this.httpClient.get<AuthResponse>(`/api/v1/auth/verify-email?token=${token}`);\r\n\r\n if (response.success && response.token) {\r\n this.token = response.token;\r\n this.httpClient.setAuthToken(response.token);\r\n this.saveTokenToStorage(response.token);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n public async logout(): Promise<void> {\r\n this.token = null;\r\n this.httpClient.removeAuthToken();\r\n this.httpClient.removeCsrfToken();\r\n this.removeTokenFromStorage();\r\n }\r\n\r\n public async getProfile(): Promise<User> {\r\n if (!this.token) {\r\n throw new Error('Not authenticated');\r\n }\r\n\r\n const response = await this.httpClient.get<{ user: User }>('/api/v1/user/me');\r\n return response.user;\r\n }\r\n\r\n public async updateProfile(data: UpdateUserData): Promise<AuthResponse> {\r\n if (!this.token) {\r\n throw new Error('Not authenticated');\r\n }\r\n\r\n const response = await this.httpClient.post<AuthResponse>('/api/v1/user/update/user', data);\r\n\r\n if (response.success && response.token) {\r\n this.token = response.token;\r\n this.httpClient.setAuthToken(response.token);\r\n this.saveTokenToStorage(response.token);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n public async getAllUsers(): Promise<User[]> {\r\n if (!this.token) {\r\n throw new Error('Not authenticated');\r\n }\r\n\r\n const response = await this.httpClient.get<{ users: User[] }>('/api/v1/user/all');\r\n return response.users;\r\n }\r\n\r\n public async getUserById(id: string): Promise<User> {\r\n const response = await this.httpClient.get<{ user: User }>(`/api/v1/user/${id}`);\r\n return response.user;\r\n }\r\n\r\n public async forgotPassword(email: string): Promise<AuthResponse> {\r\n let frontendBaseUrl: string | undefined;\r\n if (typeof window !== 'undefined') {\r\n frontendBaseUrl =\r\n process.env.FRONTEND_BASE_URL ||\r\n process.env.NEXT_PUBLIC_FRONTEND_BASE_URL ||\r\n process.env.REACT_APP_FRONTEND_BASE_URL ||\r\n process.env.NEXT_PUBLIC_APP_URL ||\r\n window.location.origin;\r\n }\r\n\r\n const response = await this.httpClient.post<AuthResponse>('/api/v1/auth/forgot-password', { email });\r\n return response;\r\n }\r\n\r\n public async resetPassword(token: string, password: string): Promise<AuthResponse> {\r\n const response = await this.httpClient.post<AuthResponse>('/api/v1/auth/reset-password', { token, password });\r\n return response;\r\n }\r\n}","'use client';\r\n\r\nimport React, { useState } from 'react';\r\nimport { useAuth } from '../use-auth';\r\n// Removed CSS import - styles will be embedded directly\r\nimport { AuthConfig } from '../../types';\r\n\r\ninterface RegisterFormProps {\r\n onRegisterSuccess?: () => void;\r\n onLoginClick?: () => void;\r\n showLoginLink?: boolean;\r\n authConfig?: AuthConfig;\r\n oauthProviders?: Array<'google' | 'github'>;\r\n showOAuthButtons?: boolean;\r\n}\r\n\r\nexport const RegisterForm: React.FC<RegisterFormProps> = ({\r\n onRegisterSuccess,\r\n onLoginClick,\r\n showLoginLink = true,\r\n authConfig,\r\n oauthProviders = ['google', 'github'],\r\n showOAuthButtons = true\r\n}) => {\r\n const [name, setName] = useState('');\r\n const [email, setEmail] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [error, setError] = useState<string | null>(null);\r\n const [showPassword, setShowPassword] = useState(false);\r\n const [showConfirmPassword, setShowConfirmPassword] = useState(false);\r\n\r\n const getPasswordStrength = (pwd: string): { strength: 'weak' | 'medium' | 'strong'; score: number; label: string } => {\r\n if (!pwd) return { strength: 'weak', score: 0, label: '' };\r\n\r\n let score = 0;\r\n if (pwd.length >= 6) score++;\r\n if (pwd.length >= 8) score++;\r\n if (/[a-z]/.test(pwd) && /[A-Z]/.test(pwd)) score++;\r\n if (/\\d/.test(pwd)) score++;\r\n if (/[^a-zA-Z\\d]/.test(pwd)) score++;\r\n\r\n if (score <= 2) return { strength: 'weak', score, label: 'Weak' };\r\n if (score <= 3) return { strength: 'medium', score, label: 'Medium' };\r\n return { strength: 'strong', score, label: 'Strong' };\r\n };\r\n\r\n const passwordStrength = getPasswordStrength(password);\r\n\r\n // Use the provided authConfig or a default one\r\n const config = authConfig || {\r\n baseUrl: typeof window !== 'undefined'\r\n ? (process.env.NEXT_PUBLIC_AUTH_API_URL || window.location.origin)\r\n : 'http://localhost:7000'\r\n };\r\n\r\n const { register } = useAuth(config);\r\n\r\n const handleSubmit = async (e: React.FormEvent) => {\r\n e.preventDefault();\r\n setIsLoading(true);\r\n setError(null);\r\n\r\n // Validate password confirmation\r\n if (password !== confirmPassword) {\r\n setError('Passwords do not match');\r\n setIsLoading(false);\r\n return;\r\n }\r\n\r\n // Validate password strength\r\n if (password.length < 6) {\r\n setError('Password must be at least 6 characters long');\r\n setIsLoading(false);\r\n return;\r\n }\r\n\r\n try {\r\n // Pass the frontend base URL to ensure correct verification links\r\n const registerData = {\r\n name,\r\n email,\r\n password,\r\n frontendBaseUrl: typeof window !== 'undefined'\r\n ? (process.env.NEXT_PUBLIC_FRONTEND_BASE_URL || process.env.REACT_APP_FRONTEND_BASE_URL || window.location.origin)\r\n : undefined\r\n };\r\n\r\n const response = await register(registerData);\r\n if (response.success) {\r\n onRegisterSuccess?.();\r\n } else {\r\n setError(response.message || 'Registration failed');\r\n }\r\n } catch (err) {\r\n setError(err instanceof Error ? err.message : 'An unknown error occurred');\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n return (\r\n <div style={{\r\n maxWidth: '400px',\r\n margin: '0 auto',\r\n padding: '30px',\r\n borderRadius: '12px',\r\n boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)',\r\n backgroundColor: '#ffffff',\r\n border: '1px solid #eaeaea'\r\n }}>\r\n <form onSubmit={handleSubmit} style={{\r\n display: 'flex',\r\n flexDirection: 'column'\r\n }}>\r\n <h2 style={{\r\n textAlign: 'center',\r\n marginBottom: '24px',\r\n color: '#1f2937',\r\n fontSize: '24px',\r\n fontWeight: 600\r\n }}>Register</h2>\r\n\r\n {error && (\r\n <div style={{\r\n padding: '12px 16px',\r\n marginBottom: '20px',\r\n backgroundColor: '#f8d7da',\r\n color: '#721c24',\r\n border: '1px solid #f5c6cb',\r\n borderRadius: '8px',\r\n fontSize: '14px',\r\n fontWeight: 500\r\n }}>\r\n {error}\r\n </div>\r\n )}\r\n\r\n <div style={{\r\n marginBottom: '20px'\r\n }}>\r\n <label htmlFor=\"name\" style={{\r\n display: 'block',\r\n marginBottom: '8px',\r\n fontWeight: 500,\r\n color: '#374151',\r\n fontSize: '14px'\r\n }}>Name:</label>\r\n <input\r\n id=\"name\"\r\n type=\"text\"\r\n value={name}\r\n onChange={(e) => setName(e.target.value)}\r\n required\r\n disabled={isLoading}\r\n style={{\r\n width: '100%',\r\n padding: '12px 16px',\r\n border: '1px solid #ddd',\r\n borderRadius: '8px',\r\n fontSize: '16px',\r\n boxSizing: 'border-box',\r\n color: '#111827',\r\n transition: 'all 0.2s ease',\r\n backgroundColor: '#ffffff'\r\n }}\r\n placeholder=\"Enter your name\"\r\n />\r\n </div>\r\n\r\n <div style={{\r\n marginBottom: '20px'\r\n }}>\r\n <label htmlFor=\"register-email\" style={{\r\n display: 'block',\r\n marginBottom: '8px',\r\n fontWeight: 500,\r\n color: '#555',\r\n fontSize: '14px'\r\n }}>Email:</label>\r\n <input\r\n id=\"register-email\"\r\n type=\"email\"\r\n value={email}\r\n onChange={(e) => setEmail(e.target.value)}\r\n required\r\n disabled={isLoading}\r\n style={{\r\n width: '100%',\r\n padding: '12px 16px',\r\n border: '1px solid #ddd',\r\n borderRadius: '8px',\r\n fontSize: '16px',\r\n boxSizing: 'border-box',\r\n color: '#333',\r\n transition: 'all 0.2s ease',\r\n backgroundColor: '#fafafa'\r\n }}\r\n placeholder=\"Enter your email\"\r\n />\r\n </div>\r\n\r\n <div style={{\r\n marginBottom: '20px'\r\n }}>\r\n <label htmlFor=\"password\" style={{\r\n display: 'block',\r\n marginBottom: '8px',\r\n fontWeight: 500,\r\n color: '#555',\r\n fontSize: '14px'\r\n }}>Password:</label>\r\n <input\r\n id=\"password\"\r\n type=\"password\"\r\n value={password}\r\n onChange={(e) => setPassword(e.target.value)}\r\n required\r\n disabled={isLoading}\r\n style={{\r\n width: '100%',\r\n padding: '12px 16px',\r\n border: '1px solid #ddd',\r\n borderRadius: '8px',\r\n fontSize: '16px',\r\n boxSizing: 'border-box',\r\n color: '#333',\r\n transition: 'all 0.2s ease',\r\n backgroundColor: '#fafafa'\r\n }}\r\n placeholder=\"Enter your password\"\r\n minLength={6}\r\n />\r\n </div>\r\n\r\n <div style={{\r\n marginBottom: '20px'\r\n }}>\r\n <label htmlFor=\"confirm-password\" style={{\r\n display: 'block',\r\n marginBottom: '8px',\r\n fontWeight: 500,\r\n color: '#555',\r\n fontSize: '14px'\r\n }}>Confirm Password:</label>\r\n <input\r\n id=\"confirm-password\"\r\n type=\"password\"\r\n value={confirmPassword}\r\n onChange={(e) => setConfirmPassword(e.target.value)}\r\n required\r\n disabled={isLoading}\r\n style={{\r\n width: '100%',\r\n padding: '12px 16px',\r\n border: '1px solid #ddd',\r\n borderRadius: '8px',\r\n fontSize: '16px',\r\n boxSizing: 'border-box',\r\n color: '#333',\r\n transition: 'all 0.2s ease',\r\n backgroundColor: '#fafafa'\r\n }}\r\n placeholder=\"Confirm your password\"\r\n />\r\n </div>\r\n\r\n <button\r\n type=\"submit\"\r\n disabled={isLoading}\r\n style={{\r\n padding: '14px',\r\n backgroundColor: '#007bff',\r\n color: 'white',\r\n border: 'none',\r\n borderRadius: '8px',\r\n fontSize: '16px',\r\n fontWeight: 600,\r\n cursor: 'pointer',\r\n transition: 'all 0.2s ease',\r\n marginTop: '8px'\r\n }}\r\n >\r\n {isLoading ? 'Registering...' : 'Register'}\r\n </button>\r\n\r\n {showOAuthButtons && oauthProviders.length > 0 && (\r\n <div style={{\r\n marginTop: '20px',\r\n paddingTop: '20px',\r\n borderTop: '1px solid #eee'\r\n }}>\r\n <div style={{\r\n position: 'relative',\r\n marginBottom: '16px'\r\n }}>\r\n <div style={{\r\n position: 'absolute',\r\n top: '50%',\r\n left: 0,\r\n right: 0,\r\n height: '1px',\r\n backgroundColor: '#eee'\r\n }} />\r\n <div style={{\r\n position: 'relative',\r\n textAlign: 'center'\r\n }}>\r\n <span style={{\r\n backgroundColor: '#ffffff',\r\n padding: '0 12px',\r\n color: '#666',\r\n fontSize: '14px'\r\n }}>Or continue with</span>\r\n </div>\r\n </div>\r\n\r\n <div style={{\r\n display: 'grid',\r\n gridTemplateColumns: oauthProviders.length === 1 ? '1fr' : 'repeat(2, 1fr)',\r\n gap: '12px'\r\n }}>\r\n {oauthProviders.includes('google') && (\r\n <a\r\n href={`${config.baseUrl}/api/v1/auth/oauth/google`}\r\n style={{\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n gap: '8px',\r\n padding: '10px 16px',\r\n backgroundColor: '#ffffff',\r\n border: '1px solid #ddd',\r\n borderRadius: '8px',\r\n color: '#333',\r\n textDecoration: 'none',\r\n fontSize: '14px',\r\n fontWeight: 500,\r\n cursor: 'pointer',\r\n transition: 'all 0.2s ease'\r\n }}\r\n onMouseEnter={(e) => {\r\n e.currentTarget.style.backgroundColor = '#f8f8f8';\r\n e.currentTarget.style.borderColor = '#007bff';\r\n }}\r\n onMouseLeave={(e) => {\r\n e.currentTarget.style.backgroundColor = '#ffffff';\r\n e.currentTarget.style.borderColor = '#ddd';\r\n }}\r\n >\r\n <svg style={{ width: '18px', height: '18px' }} viewBox=\"0 0 24 24\">\r\n <path\r\n fill=\"#4285F4\"\r\n d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"\r\n />\r\n <path\r\n fill=\"#34A853\"\r\n d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"\r\n />\r\n <path\r\n fill=\"#FBBC05\"\r\n d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\"\r\n />\r\n <path\r\n fill=\"#EA4335\"\r\n d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\"\r\n />\r\n </svg>\r\n Google\r\n </a>\r\n )}\r\n\r\n {oauthProviders.includes('github') && (\r\n <a\r\n href={`${config.baseUrl}/api/v1/auth/oauth/github`}\r\n style={{\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n gap: '8px',\r\n padding: '10px 16px',\r\n backgroundColor: '#24292e',\r\n border: '1px solid #24292e',\r\n borderRadius: '8px',\r\n color: '#ffffff',\r\n textDecoration: 'none',\r\n fontSize: '14px',\r\n fontWeight: 500,\r\n cursor: 'pointer',\r\n transition: 'all 0.2s ease'\r\n }}\r\n onMouseEnter={(e) => {\r\n e.currentTarget.style.backgroundColor = '#1b1f23';\r\n e.currentTarget.style.borderColor = '#1b1f23';\r\n }}\r\n onMouseLeave={(e) => {\r\n e.currentTarget.style.backgroundColor = '#24292e';\r\n e.currentTarget.style.borderColor = '#24292e';\r\n }}\r\n >\r\n <svg style={{ width: '18px', height: '18px' }} fill=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path d=\"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z\" />\r\n </svg>\r\n GitHub\r\n </a>\r\n )}\r\n </div>\r\n </div>\r\n )}\r\n\r\n {showLoginLink && (\r\n <div style={{\r\n textAlign: 'center',\r\n marginTop: '20px',\r\n paddingTop: '20px',\r\n borderTop: '1px solid #eee'\r\n }}>\r\n <p style={{\r\n color: '#666',\r\n fontSize: '14px'\r\n }}>\r\n Already have an account?{' '}\r\n <button\r\n type=\"button\"\r\n onClick={onLoginClick}\r\n disabled={isLoading}\r\n style={{\r\n background: 'none',\r\n border: 'none',\r\n color: '#007bff',\r\n textDecoration: 'none',\r\n cursor: 'pointer',\r\n fontSize: '14px',\r\n fontWeight: 600,\r\n padding: '0',\r\n transition: 'color 0.2s ease'\r\n }}\r\n >\r\n Login\r\n </button>\r\n </p>\r\n </div>\r\n )}\r\n </form>\r\n </div>\r\n );\r\n};","'use client';\r\n\r\nimport React, { useState } from 'react';\r\nimport { useAuth } from '../use-auth';\r\n// Removed CSS import - styles will be embedded directly\r\n\r\ninterface OtpFormProps {\r\n email: string;\r\n onVerifySuccess?: () => void;\r\n onBackToLogin?: () => void;\r\n}\r\n\r\nexport const OtpForm: React.FC<OtpFormProps> = ({\r\n email,\r\n onVerifySuccess,\r\n onBackToLogin\r\n}) => {\r\n const [otp, setOtp] = useState('');\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [error, setError] = useState<string | null>(null);\r\n const [resendCooldown, setResendCooldown] = useState(0);\r\n const [resendLoading, setResendLoading] = useState(false);\r\n \r\n const { verify, login } = useAuth({\r\n baseUrl: typeof window !== 'undefined' ? window.location.origin : 'http://localhost:7000'\r\n });\r\n\r\n const handleSubmit = async (e: React.FormEvent) => {\r\n e.preventDefault();\r\n setIsLoading(true);\r\n setError(null);\r\n \r\n // Validate OTP format\r\n if (!/^\\d{6}$/.test(otp)) {\r\n setError('Please enter a valid 6-digit OTP');\r\n setIsLoading(false);\r\n return;\r\n }\r\n \r\n try {\r\n const response = await verify({ email, otp });\r\n if (response.success) {\r\n onVerifySuccess?.();\r\n } else {\r\n setError(response.message || 'Verification failed');\r\n }\r\n } catch (err) {\r\n setError(err instanceof Error ? err.message : 'An unknown error occurred');\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n const handleOtpChange = (e: React.ChangeEvent<HTMLInputElement>) => {\r\n const value = e.target.value;\r\n // Allow only digits and limit to 6 characters\r\n if (/^\\d{0,6}$/.test(value)) {\r\n setOtp(value);\r\n }\r\n };\r\n\r\n const handleResendOtp = async () => {\r\n if (resendCooldown > 0 || resendLoading) return;\r\n \r\n setResendLoading(true);\r\n setError(null);\r\n \r\n try {\r\n const response = await login({ email });\r\n if (response.success) {\r\n // Start 60 second cooldown\r\n setResendCooldown(60);\r\n const interval = setInterval(() => {\r\n setResendCooldown((prev) => {\r\n if (prev <= 1) {\r\n clearInterval(interval);\r\n return 0;\r\n }\r\n return prev - 1;\r\n });\r\n }, 1000);\r\n } else {\r\n setError(response.message || 'Failed to resend OTP');\r\n }\r\n } catch (err) {\r\n setError(err instanceof Error ? err.message : 'Failed to resend OTP');\r\n } finally {\r\n setResendLoading(false);\r\n }\r\n };\r\n\r\n return (\r\n <div style={{\r\n maxWidth: '400px',\r\n margin: '0 auto',\r\n padding: '30px',\r\n borderRadius: '12px',\r\n boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)',\r\n backgroundColor: '#ffffff',\r\n border: '1px solid #eaeaea'\r\n }}>\r\n <form onSubmit={handleSubmit} style={{\r\n display: 'flex',\r\n flexDirection: 'column'\r\n }}>\r\n <h2 style={{\r\n textAlign: 'center',\r\n marginBottom: '24px',\r\n color: '#1f2937',\r\n fontSize: '24px',\r\n fontWeight: 600\r\n }}>Verify OTP</h2>\r\n <p style={{\r\n textAlign: 'center',\r\n marginBottom: '24px',\r\n color: '#4b5563',\r\n fontSize: '14px'\r\n }}>Enter the 6-digit code sent to <strong style={{ color: '#111827' }}>{email}</strong></p>\r\n \r\n {error && (\r\n <div style={{\r\n padding: '12px 16px',\r\n marginBottom: '20px',\r\n backgroundColor: '#f8d7da',\r\n color: '#721c24',\r\n border: '1px solid #f5c6cb',\r\n borderRadius: '8px',\r\n fontSize: '14px',\r\n fontWeight: 500\r\n }}>\r\n {error}\r\n </div>\r\n )}\r\n \r\n <div style={{\r\n marginBottom: '20px'\r\n }}>\r\n <label htmlFor=\"otp\" style={{\r\n display: 'block',\r\n marginBottom: '8px',\r\n fontWeight: 500,\r\n color: '#374151',\r\n fontSize: '14px'\r\n }}>OTP Code:</label>\r\n <input\r\n id=\"otp\"\r\n type=\"text\"\r\n value={otp}\r\n onChange={handleOtpChange}\r\n required\r\n disabled={isLoading}\r\n style={{\r\n width: '100%',\r\n padding: '12px 16px',\r\n border: '1px solid #ddd',\r\n borderRadius: '8px',\r\n fontSize: '20px',\r\n boxSizing: 'border-box',\r\n color: '#111827',\r\n transition: 'all 0.2s ease',\r\n backgroundColor: '#ffffff',\r\n textAlign: 'center',\r\n letterSpacing: '5px'\r\n }}\r\n maxLength={6}\r\n placeholder=\"123456\"\r\n autoFocus\r\n />\r\n </div>\r\n \r\n <button \r\n type=\"submit\" \r\n disabled={isLoading || otp.length !== 6}\r\n style={{\r\n padding: '14px',\r\n backgroundColor: '#007bff',\r\n color: 'white',\r\n border: 'none',\r\n borderRadius: '8px',\r\n fontSize: '16px',\r\n fontWeight: 600,\r\n cursor: 'pointer',\r\n transition: 'all 0.2s ease',\r\n marginTop: '8px'\r\n }}\r\n >\r\n {isLoading ? 'Verifying...' : 'Verify OTP'}\r\n </button>\r\n \r\n <div style={{\r\n textAlign: 'center',\r\n marginTop: '20px',\r\n paddingTop: '20px',\r\n borderTop: '1px solid #eee'\r\n }}>\r\n <button \r\n type=\"button\" \r\n onClick={handleResendOtp}\r\n disabled={isLoading || resendLoading || resendCooldown > 0}\r\n style={{\r\n background: 'none',\r\n border: 'none',\r\n color: resendCooldown > 0 ? '#999' : '#007bff',\r\n textDecoration: 'none',\r\n cursor: resendCooldown > 0 ? 'not-allowed' : 'pointer',\r\n fontSize: '14px',\r\n fontWeight: 600,\r\n padding: '0',\r\n marginBottom: '12px',\r\n transition: 'color 0.2s ease',\r\n display: 'block',\r\n width: '100%'\r\n }}\r\n >\r\n {resendLoading ? 'Sending...' : resendCooldown > 0 ? `Resend OTP in ${resendCooldown}s` : 'Resend OTP'}\r\n </button>\r\n <button \r\n type=\"button\" \r\n onClick={onBackToLogin}\r\n disabled={isLoading}\r\n style={{\r\n background: 'none',\r\n border: 'none',\r\n color: '#007bff',\r\n textDecoration: 'none',\r\n cursor: 'pointer',\r\n fontSize: '14px',\r\n fontWeight: 600,\r\n padding: '0',\r\n transition: 'color 0.2s ease'\r\n }}\r\n >\r\n Back to Login\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n );\r\n};","'use client';\r\n\r\nimport React, { useState } from 'react';\r\nimport { LoginForm } from './LoginForm';\r\nimport { RegisterForm } from './RegisterForm';\r\nimport { OtpForm } from './OtpForm';\r\n// Removed CSS import - styles will be embedded directly\r\n\r\ntype AuthStep = 'login' | 'register' | 'otp';\r\n\r\ninterface AuthFlowProps {\r\n onAuthComplete?: () => void;\r\n initialStep?: AuthStep;\r\n showTitle?: boolean;\r\n}\r\n\r\nexport const AuthFlow: React.FC<AuthFlowProps> = ({ \r\n onAuthComplete,\r\n initialStep = 'login',\r\n showTitle = true\r\n}) => {\r\n const [step, setStep] = useState<AuthStep>(initialStep);\r\n const [email, setEmail] = useState('');\r\n const [message, setMessage] = useState<string | null>(null);\r\n\r\n const handleLoginSuccess = (email: string, needsOtpVerification: boolean) => {\r\n // Set email\r\n setEmail(email);\r\n \r\n if (needsOtpVerification) {\r\n // Move to OTP verification step\r\n setStep('otp');\r\n setMessage(null);\r\n } else {\r\n // Login is complete, notify parent\r\n setMessage(null);\r\n onAuthComplete?.();\r\n }\r\n };\r\n\r\n const handleRegisterSuccess = () => {\r\n // Registration successful, show message and redirect to login\r\n setMessage('Registration successful! Please check your email for verification.');\r\n // Automatically switch to login after a short delay\r\n setTimeout(() => {\r\n setStep('login');\r\n setMessage(null);\r\n }, 3000);\r\n };\r\n\r\n const handleVerifySuccess = () => {\r\n // Authentication complete\r\n setMessage(null);\r\n onAuthComplete?.();\r\n };\r\n\r\n const handleBackToLogin = () => {\r\n setStep('login');\r\n setMessage(null);\r\n };\r\n\r\n const renderCurrentStep = () => {\r\n switch (step) {\r\n case 'login':\r\n return (\r\n <>\r\n {showTitle && <h1 style={{\r\n textAlign: 'center',\r\n marginBottom: '24px',\r\n color: '#333',\r\n fontSize: '32px',\r\n fontWeight: 700\r\n }}>Welcome Back</h1>}\r\n {message && (\r\n <div style={{\r\n padding: '12px 16px',\r\n marginBottom: '20px',\r\n backgroundColor: '#d4edda',\r\n color: '#155724',\r\n border: '1px solid #c3e6cb',\r\n borderRadius: '8px',\r\n fontSize: '14px',\r\n fontWeight: 500\r\n }}>\r\n {message}\r\n </div>\r\n )}\r\n <LoginForm\r\n onLoginSuccess={handleLoginSuccess}\r\n onRegisterClick={() => setStep('register')}\r\n showRegisterLink={true}\r\n />\r\n </>\r\n );\r\n \r\n case 'register':\r\n return (\r\n <>\r\n {showTitle && <h1 style={{\r\n textAlign: 'center',\r\n marginBottom: '24px',\r\n color: '#333',\r\n fontSize: '32px',\r\n fontWeight: 700\r\n }}>Create Account</h1>}\r\n {message && (\r\n <div style={{\r\n padding: '12px 16px',\r\n marginBottom: '20px',\r\n backgroundColor: '#d4edda',\r\n color: '#155724',\r\n border: '1px solid #c3e6cb',\r\n borderRadius: '8px',\r\n fontSize: '14px',\r\n fontWeight: 500\r\n }}>\r\n {message}\r\n </div>\r\n )}\r\n <RegisterForm\r\n onRegisterSuccess={handleRegisterSuccess}\r\n onLoginClick={() => setStep('login')}\r\n showLoginLink={true}\r\n />\r\n </>\r\n );\r\n \r\n case 'otp':\r\n return (\r\n <>\r\n {showTitle && <h1 style={{\r\n textAlign: 'center',\r\n marginBottom: '24px',\r\n color: '#333',\r\n fontSize: '32px',\r\n fontWeight: 700\r\n }}>Verify Your Email</h1>}\r\n <OtpForm\r\n email={email}\r\n onVerifySuccess={handleVerifySuccess}\r\n onBackToLogin={handleBackToLogin}\r\n />\r\n </>\r\n );\r\n \r\n default:\r\n return (\r\n <>\r\n {showTitle && <h1 style={{\r\n textAlign: 'center',\r\n marginBottom: '24px',\r\n color: '#333',\r\n fontSize: '32px',\r\n fontWeight: 700\r\n }}>Welcome Back</h1>}\r\n <LoginForm\r\n onLoginSuccess={handleLoginSuccess}\r\n onRegisterClick={() => setStep('register')}\r\n showRegisterLink={true}\r\n />\r\n </>\r\n );\r\n }\r\n };\r\n\r\n return (\r\n <div style={{\r\n minHeight: '300px',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center'\r\n }}>\r\n {renderCurrentStep()}\r\n </div>\r\n );\r\n};","'use client';\r\n\r\nimport React, { useState, useEffect } from 'react';\r\nimport { useAuth } from '../use-auth';\r\n// Removed CSS import - styles will be embedded directly\r\n\r\ninterface EmailVerificationPageProps {\r\n token: string;\r\n onVerificationSuccess?: () => void;\r\n onVerificationError?: (error: string) => void;\r\n baseUrl?: string;\r\n}\r\n\r\nexport const EmailVerificationPage: React.FC<EmailVerificationPageProps> = ({\r\n token,\r\n onVerificationSuccess,\r\n onVerificationError,\r\n baseUrl\r\n}) => {\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [message, setMessage] = useState('');\r\n const [isSuccess, setIsSuccess] = useState(false);\r\n \r\n const { verifyEmailToken } = useAuth({\r\n baseUrl: baseUrl || (typeof window !== 'undefined' ? window.location.origin : 'http://localhost:7000')\r\n });\r\n\r\n useEffect(() => {\r\n const verifyEmail = async () => {\r\n if (!token) {\r\n setIsLoading(false);\r\n setMessage('Invalid verification token');\r\n setIsSuccess(false);\r\n onVerificationError?.('Invalid verification token');\r\n return;\r\n }\r\n\r\n try {\r\n const response = await verifyEmailToken(token);\r\n \r\n if (response.success) {\r\n setIsLoading(false);\r\n setMessage(response.message || 'Email verified successfully!');\r\n setIsSuccess(true);\r\n onVerificationSuccess?.();\r\n } else {\r\n setIsLoading(false);\r\n setMessage(response.message || 'Email verification failed');\r\n setIsSuccess(false);\r\n onVerificationError?.(response.message || 'Email verification failed');\r\n }\r\n } catch (err) {\r\n setIsLoading(false);\r\n const errorMessage = err instanceof Error ? err.message : 'An unknown error occurred';\r\n setMessage(errorMessage);\r\n setIsSuccess(false);\r\n onVerificationError?.(errorMessage);\r\n }\r\n };\r\n\r\n verifyEmail();\r\n }, [token, verifyEmailToken, onVerificationSuccess, onVerificationError]);\r\n\r\n if (isLoading) {\r\n return (\r\n <div style={{\r\n maxWidth: '500px',\r\n margin: '0 auto',\r\n padding: '30px',\r\n borderRadius: '12px',\r\n boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)',\r\n backgroundColor: '#ffffff',\r\n textAlign: 'center',\r\n border: '1px solid #eaeaea'\r\n }}>\r\n <div style={{\r\n padding: '20px'\r\n }}>\r\n <h2 style={{ color: 'black' }}>Verifying your email...</h2>\r\n <div style={{\r\n border: '4px solid #f3f3f3',\r\n borderTop: '4px solid #007bff',\r\n borderRadius: '50%',\r\n width: '40px',\r\n height: '40px',\r\n animation: 'spin 2s linear infinite',\r\n margin: '20px auto'\r\n }}></div>\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <div style={{\r\n maxWidth: '500px',\r\n margin: '0 auto',\r\n padding: '30px',\r\n borderRadius: '12px',\r\n boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)',\r\n backgroundColor: '#ffffff',\r\n textAlign: 'center',\r\n border: '1px solid #eaeaea'\r\n }}>\r\n <div style={{\r\n padding: '20px'\r\n }}>\r\n <h2 style={{ color: 'black' }}>Email Verification</h2>\r\n <div style={{\r\n padding: '16px 20px',\r\n margin: '24px 0',\r\n borderRadius: '8px',\r\n fontSize: '15px',\r\n fontWeight: 500,\r\n backgroundColor: isSuccess ? '#d4edda' : '#f8d7da',\r\n color: isSuccess ? '#155724' : '#721c24',\r\n border: isSuccess ? '1px solid #c3e6cb' : '1px solid #f5c6cb'\r\n }}>\r\n {message}\r\n </div>\r\n {isSuccess && (\r\n <div style={{\r\n marginTop: '24px'\r\n }}>\r\n <p style={{ color: 'black' }}>Your email has been successfully verified!</p>\r\n <button \r\n onClick={() => window.location.href = '/login'}\r\n style={{\r\n padding: '12px 24px',\r\n backgroundColor: '#007bff',\r\n color: 'white',\r\n border: 'none',\r\n borderRadius: '8px',\r\n fontSize: '16px',\r\n fontWeight: 600,\r\n cursor: 'pointer',\r\n transition: 'all 0.2s ease'\r\n }}\r\n >\r\n Go to Login\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n );\r\n};"]}
|