diff --git a/backend/src/scripts/createAdmin.js b/backend/src/scripts/createAdmin.js new file mode 100644 index 0000000..5738198 --- /dev/null +++ b/backend/src/scripts/createAdmin.js @@ -0,0 +1,33 @@ +const bcrypt = require('bcrypt') +const prisma = require('../config/prisma') + +async function createAdmin() { + const email = 'admin@thetiptop.fr' + const password = 'Admin@TipTop2026!' + + const existing = await prisma.user.findUnique({ where: { email } }) + if (existing) { + console.log('Admin déjà existant :', email) + return + } + + const hashed = await bcrypt.hash(password, 10) + + await prisma.user.create({ + data: { + firstname: 'Admin', + lastname: 'TipTop', + email, + password: hashed, + role: 'ADMIN', + }, + }) + + console.log('✅ Admin créé avec succès') + console.log(' Email :', email) + console.log(' Mot de passe :', password) +} + +createAdmin() + .catch((e) => { console.error('Erreur :', e.message); process.exit(1) }) + .finally(() => prisma.$disconnect()) diff --git a/frontend/src/pages/Inscription.jsx b/frontend/src/pages/Inscription.jsx index ae9c804..d959977 100644 --- a/frontend/src/pages/Inscription.jsx +++ b/frontend/src/pages/Inscription.jsx @@ -5,6 +5,7 @@ import { registerApi } from '../services/auth' export default function Inscription() { const navigate = useNavigate() const [form, setForm] = useState({ email: '', lastName: '', firstName: '', password: '' }) + const [acceptedTerms, setAcceptedTerms] = useState(false) const [showPassword, setShowPassword] = useState(false) const [error, setError] = useState('') const [loading, setLoading] = useState(false) @@ -132,9 +133,29 @@ export default function Inscription() { + +