diff --git a/db.json b/db.json index 66ebc10..0fdecc7 100644 --- a/db.json +++ b/db.json @@ -165,5 +165,27 @@ "city_id": "", "mobile": "07559393995" } + ], + "cities": [ + { + "id": "1", + "name": "New York" + }, + { + "id": "2", + "name": "Los Angeles" + }, + { + "id": "3", + "name": "Chicago" + }, + { + "id": "4", + "name": "Houston" + }, + { + "id": "5", + "name": "Phoenix" + } ] -} \ No newline at end of file +} diff --git a/lib/api/axiosConfig.js b/lib/api/axiosConfig.js index b2f0722..de424bc 100644 --- a/lib/api/axiosConfig.js +++ b/lib/api/axiosConfig.js @@ -1,7 +1,8 @@ import axios from 'axios'; const axiosInstance = axios.create({ - baseURL: 'http://localhost:5000' + baseURL: 'http://localhost:5000', + timeout: 10000, }); export default axiosInstance; \ No newline at end of file diff --git a/src/components/Auth/LoginPage.css b/src/components/Auth/LoginPage.css index bafd8fe..124b45d 100644 --- a/src/components/Auth/LoginPage.css +++ b/src/components/Auth/LoginPage.css @@ -5,10 +5,8 @@ body, html { padding: 0; font-family: 'Nunito Sans', sans-serif; background-color: #ffffff; - /* color: #fff; */ } - .login-page { display: flex; align-items: center; @@ -16,34 +14,15 @@ body, html { min-height: 100vh; padding: 4rem; background-color: #ffffff; -} - -.login-container { - /* background-color: #222; */ - border-radius: 8px; - padding: 40px; - box-shadow: 0 0 10px #d1d5db; - width: 310.4px; - display: flex; - flex-direction: column; - row-gap: 28px; - column-gap: 28px; - font-size: 14px; - font-weight: 500; - line-height: 14px; - box-sizing: border-box; -} - -.form-container { - display: flex; - flex-direction: column; - align-items: center; + position: relative; } .logo { - display: block; - margin: 0 auto 20px; - width: 100px; + position: absolute; + top: 1rem; + left: 1rem; + width: 100px; + height: auto; } h1 { @@ -58,44 +37,20 @@ p { text-align: center; } -form { - display: flex; - flex-direction: column; - align-items: center; - width: 100%; -} - -label { - display: none; -} - -/* input[type="email"], -input[type="password"] { +input { width: 100%; padding: 12px; margin-bottom: 20px; border: 1px solid #B3B3B3; border-radius: 4px; font-size: 16px; - background-color: #09090B; - color: #fff; + background-color: #e8e8e8; + color: #4b5563; box-sizing: border-box; -} */ - -.login-page input { - width: 100%; - padding: 12px; - margin-bottom: 20px; - border: 1px solid #B3B3B3; /* Darker border */ - border-radius: 4px; - font-size: 16px; - background-color: #e8e8e8; /* Dark background for input fields */ - color: #4b5563; /* White text for input fields */ } -input[type="email"]:focus, -input[type="password"]:focus { - border-color: #4b5563; +input:focus { + border-color: #0e355b; outline: none; } @@ -112,10 +67,6 @@ input[type="password"]:focus { text-decoration: none; } -/* .forgot-password-container a:hover { - text-decoration: underline; -} */ - .login-button { width: 100%; padding: 15px 30px; @@ -130,15 +81,3 @@ input[type="password"]:focus { .login-button:hover { background-color: #154676; } - -.login-page input:focus { - border-color: #0e355b; /* Orange border on focus */ - outline: none; -} - -.login-page a { - color: #4b5563; - text-decoration: none; - margin-bottom: 20px; - display: inline-block; -} diff --git a/src/components/Auth/LoginPage.jsx b/src/components/Auth/LoginPage.jsx index 846e697..a2250d7 100644 --- a/src/components/Auth/LoginPage.jsx +++ b/src/components/Auth/LoginPage.jsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import axiosInstance from '../../api/axiosConfig'; -import './LoginPage.css'; import BrookslogoIcon from '../../assets/thob-data/BrookslogoIcon.svg'; const LoginPage = () => { @@ -19,7 +18,7 @@ const LoginPage = () => { const user = response.data.find(user => user.email === email && user.password === password); if (user) { - localStorage.setItem("loggedInUser", JSON.stringify(user)) + localStorage.setItem("loggedInUser", JSON.stringify(user)); if (user.role === 'admin') { navigate('/admin'); } else if (user.role === 'employee') { @@ -42,43 +41,42 @@ const LoginPage = () => { }; return ( -
be among the first to experience 3D magic! register for private alpha.
- {error &&{error}
} - +be among the first to experience 3D magic! Register for private alpha.
+ {error &&{error}
} +welcome back, {userName}
diff --git a/src/services/server.js b/src/services/server.js index d3cfbec..6dbec0b 100644 --- a/src/services/server.js +++ b/src/services/server.js @@ -1,4 +1,3 @@ -// server.js const express = require('express'); const bodyParser = require('body-parser'); const nodemailer = require('nodemailer'); @@ -10,11 +9,26 @@ const port = 5000; app.use(bodyParser.json()); let users = [ - // Example users { email: 'admin@example.com', password: 'admin123', role: 'admin' }, { email: 'employee@example.com', password: 'employee123', role: 'employee' }, ]; +// Endpoint to handle login requests +app.post('/auth/login', (req, res) => { + const { email, password } = req.body; + const user = users.find(user => user.email === email && user.password === password); + + if (!user) { + return res.status(401).json({ success: false, message: 'Invalid email or password' }); + } + + res.status(200).json({ + success: true, + message: 'Login successful', + role: user.role, + }); +}); + // Endpoint to handle password reset requests app.post('/auth/forgot-password', (req, res) => { const { email } = req.body; diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 4489c31..ca101d4 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -1,4 +1,5 @@ /** @type {import('tailwindcss').Config} */ + module.exports = { content: [ './src/**/*.{html,js,jsx}', @@ -13,6 +14,7 @@ module.exports = { 'secondary-text': '#4b5563', 'button-text': '#d1d5db', }, + fontFamily: { sans: ['"Nunito Sans"', 'sans-serif'], },