diff --git a/backend/src/utils/validation.js b/backend/src/utils/validation.js index feb5ab6..df966a6 100644 --- a/backend/src/utils/validation.js +++ b/backend/src/utils/validation.js @@ -3,7 +3,7 @@ const Joi = require('joi'); // User validation schemas const registerSchema = Joi.object({ email: Joi.string().email().required(), - password: Joi.string().min(8).pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/).required() + password: Joi.string().min(8).pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#+])[A-Za-z\d@$!%*?&#+]/).required() .messages({ 'string.pattern.base': 'Password must contain at least one lowercase letter, one uppercase letter, one number, and one special character' }), @@ -24,7 +24,7 @@ const updateUserSchema = Joi.object({ const changePasswordSchema = Joi.object({ currentPassword: Joi.string().required(), - newPassword: Joi.string().min(8).pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/).required() + newPassword: Joi.string().min(8).pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#+])[A-Za-z\d@$!%*?&#+]/).required() .messages({ 'string.pattern.base': 'Password must contain at least one lowercase letter, one uppercase letter, one number, and one special character' }) diff --git a/docker-compose.yml b/docker-compose.yml index a81d57e..4935aa1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: context: ./backend dockerfile: Dockerfile environment: - - NODE_ENV=production + - NODE_ENV=development - DB_HOST=db - DB_PORT=5432 - DB_NAME=${DB_NAME:-turftracker} diff --git a/frontend/src/contexts/AuthContext.js b/frontend/src/contexts/AuthContext.js index 80d97a4..d963130 100644 --- a/frontend/src/contexts/AuthContext.js +++ b/frontend/src/contexts/AuthContext.js @@ -161,7 +161,8 @@ export const AuthProvider = ({ children }) => { toast.success('Account created successfully!'); return { success: true }; } catch (error) { - const errorMessage = error.response?.data?.message || 'Registration failed. Please try again.'; + console.error('Registration error:', error); + const errorMessage = error.response?.data?.message || error.message || 'Registration failed. Please try again.'; dispatch({ type: actionTypes.SET_ERROR, payload: errorMessage }); toast.error(errorMessage); return { success: false, error: errorMessage }; diff --git a/frontend/src/pages/Auth/Register.js b/frontend/src/pages/Auth/Register.js index 9f6b2f7..8994402 100644 --- a/frontend/src/pages/Auth/Register.js +++ b/frontend/src/pages/Auth/Register.js @@ -151,7 +151,7 @@ const Register = () => { message: 'Password must be at least 8 characters', }, pattern: { - value: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/, + value: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#+])[A-Za-z\d@$!%*?&#+]/, message: 'Password must contain uppercase, lowercase, number, and special character', }, })}