sms #3
@ -1,179 +0,0 @@
|
|||||||
const express = require('express');
|
|
||||||
const cors = require('cors');
|
|
||||||
const fetch = require('node-fetch');
|
|
||||||
|
|
||||||
// Initialisation de l'application Express
|
|
||||||
const app = express();
|
|
||||||
const PORT = process.env.PORT || 8080;
|
|
||||||
|
|
||||||
// Configuration CORS
|
|
||||||
const corsOptions = {
|
|
||||||
origin: ['http://local.lecoffreio.4nkweb:3000', 'http://localhost:3000'],
|
|
||||||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
|
||||||
allowedHeaders: ['Content-Type', 'Authorization']
|
|
||||||
};
|
|
||||||
|
|
||||||
app.use(cors(corsOptions));
|
|
||||||
app.use(express.json());
|
|
||||||
|
|
||||||
function getOfficeStatus(statusName) {
|
|
||||||
switch (statusName) {
|
|
||||||
case 'Pourvu':
|
|
||||||
return 'ACTIVATED';
|
|
||||||
case 'Pourvu mais décédé':
|
|
||||||
return 'ACTIVATED';
|
|
||||||
case 'Sans titulaire':
|
|
||||||
return 'ACTIVATED';
|
|
||||||
case 'Vacance':
|
|
||||||
return 'ACTIVATED';
|
|
||||||
case 'En activité':
|
|
||||||
return 'ACTIVATED';
|
|
||||||
default:
|
|
||||||
return 'DESACTIVATED';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRole(roleName) {
|
|
||||||
switch (roleName) {
|
|
||||||
case 'Notaire titulaire':
|
|
||||||
return { name: 'admin', label: 'Administrateur' };
|
|
||||||
case 'Notaire associé':
|
|
||||||
return { name: 'admin', label: 'Administrateur' };
|
|
||||||
case 'Notaire salarié':
|
|
||||||
return { name: 'notary', label: 'Notaire' };
|
|
||||||
case 'Collaborateur':
|
|
||||||
return { name: 'notary', label: 'Notaire' };
|
|
||||||
case 'Suppléant':
|
|
||||||
return { name: 'notary', label: 'Notaire' };
|
|
||||||
case 'Administrateur':
|
|
||||||
return { name: 'admin', label: 'Administrateur' };
|
|
||||||
case 'Curateur':
|
|
||||||
return { name: 'notary', label: 'Notaire' };
|
|
||||||
default:
|
|
||||||
return { name: 'default', label: 'Défaut' };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCivility(civility) {
|
|
||||||
switch (civility) {
|
|
||||||
case 'Monsieur':
|
|
||||||
return 'MALE';
|
|
||||||
case 'Madame':
|
|
||||||
return 'FEMALE';
|
|
||||||
default:
|
|
||||||
return 'OTHERS';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
app.get('/api/v1/health', (req, res) => {
|
|
||||||
res.json({ message: 'OK' });
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/api/v1/idnot/user/:code', async (req, res) => {
|
|
||||||
const code = req.params.code;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const params = {
|
|
||||||
client_id: 'B3CE56353EDB15A9',
|
|
||||||
client_secret: '3F733549E879878344B6C949B366BB5CDBB2DB5B7F7AB7EBBEBB0F0DD0776D1C',
|
|
||||||
redirect_uri: 'http://local.lecoffreio.4nkweb:3000/authorized-client',
|
|
||||||
grant_type: 'authorization_code',
|
|
||||||
code: code
|
|
||||||
};
|
|
||||||
|
|
||||||
const tokens = await (
|
|
||||||
await fetch('https://qual-connexion.idnot.fr/user/IdPOAuth2/token/idnot_idp_v1', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
body: new URLSearchParams(params).toString()
|
|
||||||
})
|
|
||||||
).json();
|
|
||||||
|
|
||||||
const jwt = tokens.id_token;
|
|
||||||
if (!jwt) {
|
|
||||||
console.error('jwt not defined');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const payload = JSON.parse(Buffer.from(jwt.split('.')[1], 'base64').toString('utf8'));
|
|
||||||
|
|
||||||
const searchParams = new URLSearchParams({
|
|
||||||
key: 'ba557f84-0bf6-4dbf-844f-df2767555e3e'
|
|
||||||
});
|
|
||||||
|
|
||||||
let userData;
|
|
||||||
try {
|
|
||||||
userData = await (
|
|
||||||
await fetch(`https://qual-api.notaires.fr/annuaire/api/pp/v2/rattachements/${payload.profile_idn}?` + searchParams, {
|
|
||||||
method: 'GET'
|
|
||||||
})
|
|
||||||
).json();
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching ' + `https://qual-api.notaires.fr/annuaire/api/pp/v2/rattachements/${payload.profile_idn}`, error);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!userData || !userData.statutDuRattachement || userData.entite.typeEntite.name !== 'office') {
|
|
||||||
console.error('User not attached to an office (May be a partner)');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let officeLocationData;
|
|
||||||
try {
|
|
||||||
officeLocationData = (await (
|
|
||||||
await fetch(`https://qual-api.notaires.fr/annuaire${userData.entite.locationsUrl}?` + searchParams,
|
|
||||||
{
|
|
||||||
method: 'GET'
|
|
||||||
})
|
|
||||||
).json());
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching' + `https://qual-api.notaires.fr/annuaire${userData.entite.locationsUrl}`, error);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!officeLocationData || !officeLocationData.result || officeLocationData.result.length === 0) {
|
|
||||||
console.error('Office location data not found');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const idnotUser = {
|
|
||||||
idNot: payload.sub,
|
|
||||||
office: {
|
|
||||||
idNot: payload.entity_idn,
|
|
||||||
name: userData.entite.denominationSociale ?? userData.entite.codeCrpcen,
|
|
||||||
crpcen: userData.entite.codeCrpcen,
|
|
||||||
office_status: getOfficeStatus(userData.entite.statutEntite.name),
|
|
||||||
address: {
|
|
||||||
address: officeLocationData.result[0].adrGeo4,
|
|
||||||
city: officeLocationData.result[0].adrGeoVille.split(' ')[0] ?? officeLocationData.result[0].adrGeoVille,
|
|
||||||
zip_code: Number(officeLocationData.result[0].adrGeoCodePostal)
|
|
||||||
},
|
|
||||||
status: 'ACTIVE'
|
|
||||||
},
|
|
||||||
role: getRole(userData.typeLien.name),
|
|
||||||
contact: {
|
|
||||||
first_name: userData.personne.prenom,
|
|
||||||
last_name: userData.personne.nomUsuel,
|
|
||||||
email: userData.mailRattachement,
|
|
||||||
phone_number: userData.numeroTelephone,
|
|
||||||
cell_phone_number: userData.numeroMobile ?? userData.numeroTelephone,
|
|
||||||
civility: getCivility(userData.personne.civilite)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!idnotUser.contact.email) {
|
|
||||||
console.error("User pro email empty");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
res.json(idnotUser);
|
|
||||||
} catch (error) {
|
|
||||||
res.status(500).json({
|
|
||||||
error: 'Internal Server Error',
|
|
||||||
message: error.message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
|
||||||
console.log(`Server is running on port ${PORT}`);
|
|
||||||
});
|
|
209
src/server.js
209
src/server.js
@ -1,25 +1,197 @@
|
|||||||
const express = require('express');
|
const express = require('express');
|
||||||
|
const cors = require('cors');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const ovh = require('ovh');
|
const ovh = require('ovh');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
|
// Initialisation de l'application Express
|
||||||
const app = express();
|
const app = express();
|
||||||
|
const PORT = process.env.PORT || 8080;
|
||||||
|
|
||||||
|
// Configuration CORS
|
||||||
|
const corsOptions = {
|
||||||
|
origin: ['http://local.lecoffreio.4nkweb:3000', 'http://localhost:3000'],
|
||||||
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
||||||
|
allowedHeaders: ['Content-Type', 'Authorization']
|
||||||
|
};
|
||||||
|
|
||||||
|
app.use(cors(corsOptions));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
|
function getOfficeStatus(statusName) {
|
||||||
|
switch (statusName) {
|
||||||
|
case 'Pourvu':
|
||||||
|
return 'ACTIVATED';
|
||||||
|
case 'Pourvu mais décédé':
|
||||||
|
return 'ACTIVATED';
|
||||||
|
case 'Sans titulaire':
|
||||||
|
return 'ACTIVATED';
|
||||||
|
case 'Vacance':
|
||||||
|
return 'ACTIVATED';
|
||||||
|
case 'En activité':
|
||||||
|
return 'ACTIVATED';
|
||||||
|
default:
|
||||||
|
return 'DESACTIVATED';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRole(roleName) {
|
||||||
|
switch (roleName) {
|
||||||
|
case 'Notaire titulaire':
|
||||||
|
return { name: 'admin', label: 'Administrateur' };
|
||||||
|
case 'Notaire associé':
|
||||||
|
return { name: 'admin', label: 'Administrateur' };
|
||||||
|
case 'Notaire salarié':
|
||||||
|
return { name: 'notary', label: 'Notaire' };
|
||||||
|
case 'Collaborateur':
|
||||||
|
return { name: 'notary', label: 'Notaire' };
|
||||||
|
case 'Suppléant':
|
||||||
|
return { name: 'notary', label: 'Notaire' };
|
||||||
|
case 'Administrateur':
|
||||||
|
return { name: 'admin', label: 'Administrateur' };
|
||||||
|
case 'Curateur':
|
||||||
|
return { name: 'notary', label: 'Notaire' };
|
||||||
|
default:
|
||||||
|
return { name: 'default', label: 'Défaut' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCivility(civility) {
|
||||||
|
switch (civility) {
|
||||||
|
case 'Monsieur':
|
||||||
|
return 'MALE';
|
||||||
|
case 'Madame':
|
||||||
|
return 'FEMALE';
|
||||||
|
default:
|
||||||
|
return 'OTHERS';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app.get('/api/v1/health', (req, res) => {
|
||||||
|
res.json({ message: 'OK' });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post('/api/v1/idnot/user/:code', async (req, res) => {
|
||||||
|
const code = req.params.code;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
client_id: 'B3CE56353EDB15A9',
|
||||||
|
client_secret: '3F733549E879878344B6C949B366BB5CDBB2DB5B7F7AB7EBBEBB0F0DD0776D1C',
|
||||||
|
redirect_uri: 'http://local.lecoffreio.4nkweb:3000/authorized-client',
|
||||||
|
grant_type: 'authorization_code',
|
||||||
|
code: code
|
||||||
|
};
|
||||||
|
|
||||||
|
const tokens = await (
|
||||||
|
await fetch('https://qual-connexion.idnot.fr/user/IdPOAuth2/token/idnot_idp_v1', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: new URLSearchParams(params).toString()
|
||||||
|
})
|
||||||
|
).json();
|
||||||
|
|
||||||
|
const jwt = tokens.id_token;
|
||||||
|
if (!jwt) {
|
||||||
|
console.error('jwt not defined');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const payload = JSON.parse(Buffer.from(jwt.split('.')[1], 'base64').toString('utf8'));
|
||||||
|
|
||||||
|
const searchParams = new URLSearchParams({
|
||||||
|
key: 'ba557f84-0bf6-4dbf-844f-df2767555e3e'
|
||||||
|
});
|
||||||
|
|
||||||
|
let userData;
|
||||||
|
try {
|
||||||
|
userData = await (
|
||||||
|
await fetch(`https://qual-api.notaires.fr/annuaire/api/pp/v2/rattachements/${payload.profile_idn}?` + searchParams, {
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
).json();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching ' + `https://qual-api.notaires.fr/annuaire/api/pp/v2/rattachements/${payload.profile_idn}`, error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!userData || !userData.statutDuRattachement || userData.entite.typeEntite.name !== 'office') {
|
||||||
|
console.error('User not attached to an office (May be a partner)');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
let officeLocationData;
|
||||||
|
try {
|
||||||
|
officeLocationData = (await (
|
||||||
|
await fetch(`https://qual-api.notaires.fr/annuaire${userData.entite.locationsUrl}?` + searchParams,
|
||||||
|
{
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
).json());
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching' + `https://qual-api.notaires.fr/annuaire${userData.entite.locationsUrl}`, error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!officeLocationData || !officeLocationData.result || officeLocationData.result.length === 0) {
|
||||||
|
console.error('Office location data not found');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const idnotUser = {
|
||||||
|
idNot: payload.sub,
|
||||||
|
office: {
|
||||||
|
idNot: payload.entity_idn,
|
||||||
|
name: userData.entite.denominationSociale ?? userData.entite.codeCrpcen,
|
||||||
|
crpcen: userData.entite.codeCrpcen,
|
||||||
|
office_status: getOfficeStatus(userData.entite.statutEntite.name),
|
||||||
|
address: {
|
||||||
|
address: officeLocationData.result[0].adrGeo4,
|
||||||
|
city: officeLocationData.result[0].adrGeoVille.split(' ')[0] ?? officeLocationData.result[0].adrGeoVille,
|
||||||
|
zip_code: Number(officeLocationData.result[0].adrGeoCodePostal)
|
||||||
|
},
|
||||||
|
status: 'ACTIVE'
|
||||||
|
},
|
||||||
|
role: getRole(userData.typeLien.name),
|
||||||
|
contact: {
|
||||||
|
first_name: userData.personne.prenom,
|
||||||
|
last_name: userData.personne.nomUsuel,
|
||||||
|
email: userData.mailRattachement,
|
||||||
|
phone_number: userData.numeroTelephone,
|
||||||
|
cell_phone_number: userData.numeroMobile ?? userData.numeroTelephone,
|
||||||
|
civility: getCivility(userData.personne.civilite)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!idnotUser.contact.email) {
|
||||||
|
console.error("User pro email empty");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
res.json(idnotUser);
|
||||||
|
} catch (error) {
|
||||||
|
res.status(500).json({
|
||||||
|
error: 'Internal Server Error',
|
||||||
|
message: error.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//------------------------------------ SMS Section ------------------------------------
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
// Configuration OVH
|
// OVH config
|
||||||
OVH_APP_KEY: process.env.OVH_APP_KEY,
|
OVH_APP_KEY: process.env.OVH_APP_KEY,
|
||||||
OVH_APP_SECRET: process.env.OVH_APP_SECRET,
|
OVH_APP_SECRET: process.env.OVH_APP_SECRET,
|
||||||
OVH_CONSUMER_KEY: process.env.OVH_CONSUMER_KEY,
|
OVH_CONSUMER_KEY: process.env.OVH_CONSUMER_KEY,
|
||||||
OVH_SMS_SERVICE_NAME: process.env.OVH_SMS_SERVICE_NAME,
|
OVH_SMS_SERVICE_NAME: process.env.OVH_SMS_SERVICE_NAME,
|
||||||
|
|
||||||
// Configuration SMS Factor
|
// SMS Factor config
|
||||||
SMS_FACTOR_TOKEN: process.env.SMS_FACTOR_TOKEN,
|
SMS_FACTOR_TOKEN: process.env.SMS_FACTOR_TOKEN,
|
||||||
|
|
||||||
PORT: process.env.PORT || 8080
|
PORT: process.env.PORT || 8080
|
||||||
};
|
};
|
||||||
|
|
||||||
// Stockage temporaire des codes
|
// Codes storage
|
||||||
const verificationCodes = new Map();
|
const verificationCodes = new Map();
|
||||||
|
|
||||||
// Service SMS
|
// Service SMS
|
||||||
@ -28,7 +200,7 @@ class SmsService {
|
|||||||
return Math.floor(100000 + Math.random() * 900000);
|
return Math.floor(100000 + Math.random() * 900000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service OVH
|
// OVH Service
|
||||||
static sendSmsWithOvh(phoneNumber, message) {
|
static sendSmsWithOvh(phoneNumber, message) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const ovhClient = ovh({
|
const ovhClient = ovh({
|
||||||
@ -54,7 +226,7 @@ class SmsService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service SMS Factor
|
// SMS Factor Service
|
||||||
static async sendSmsWithSmsFactor(phoneNumber, message) {
|
static async sendSmsWithSmsFactor(phoneNumber, message) {
|
||||||
try {
|
try {
|
||||||
const url = new URL('https://api.smsfactor.com/send/simulate');
|
const url = new URL('https://api.smsfactor.com/send/simulate');
|
||||||
@ -76,22 +248,22 @@ class SmsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Méthode principale d'envoi
|
// Main method
|
||||||
static async sendSms(phoneNumber, message) {
|
static async sendSms(phoneNumber, message) {
|
||||||
// Essai d'abord avec OVH
|
// Try first with OVH
|
||||||
const ovhResult = await this.sendSmsWithOvh(phoneNumber, message);
|
const ovhResult = await this.sendSmsWithOvh(phoneNumber, message);
|
||||||
|
|
||||||
if (ovhResult.success) {
|
if (ovhResult.success) {
|
||||||
return ovhResult;
|
return ovhResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si OVH échoue, essai avec SMS Factor
|
// If OVH fails, try with SMS Factor
|
||||||
console.log('OVH SMS failed, trying SMS Factor...');
|
console.log('OVH SMS failed, trying SMS Factor...');
|
||||||
return await this.sendSmsWithSmsFactor(phoneNumber, message);
|
return await this.sendSmsWithSmsFactor(phoneNumber, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Middleware de validation
|
// Phone number validation middleware
|
||||||
const validatePhoneNumber = (req, res, next) => {
|
const validatePhoneNumber = (req, res, next) => {
|
||||||
const { phoneNumber } = req.body;
|
const { phoneNumber } = req.body;
|
||||||
|
|
||||||
@ -115,11 +287,11 @@ const validatePhoneNumber = (req, res, next) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
app.post('/api/send-verification', validatePhoneNumber, async (req, res) => {
|
app.post('/api/send-code', validatePhoneNumber, async (req, res) => {
|
||||||
const { phoneNumber } = req.body;
|
const { phoneNumber } = req.body;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Vérifier si un code existe déjà et n'est pas expiré
|
// Check if a code already exists and is not expired
|
||||||
const existingVerification = verificationCodes.get(phoneNumber);
|
const existingVerification = verificationCodes.get(phoneNumber);
|
||||||
if (existingVerification) {
|
if (existingVerification) {
|
||||||
const timeSinceLastSend = Date.now() - existingVerification.timestamp;
|
const timeSinceLastSend = Date.now() - existingVerification.timestamp;
|
||||||
@ -131,17 +303,17 @@ app.post('/api/send-verification', validatePhoneNumber, async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Générer un nouveau code
|
// Generate a new code
|
||||||
const code = SmsService.generateCode();
|
const code = SmsService.generateCode();
|
||||||
|
|
||||||
// Stocker le code
|
// Store the code
|
||||||
verificationCodes.set(phoneNumber, {
|
verificationCodes.set(phoneNumber, {
|
||||||
code,
|
code,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
attempts: 0
|
attempts: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
// Envoyer le SMS
|
// Send the SMS
|
||||||
const message = `Votre code de vérification LeCoffre est : ${code}`;
|
const message = `Votre code de vérification LeCoffre est : ${code}`;
|
||||||
const result = await SmsService.sendSms(phoneNumber, message);
|
const result = await SmsService.sendSms(phoneNumber, message);
|
||||||
|
|
||||||
@ -184,7 +356,7 @@ app.post('/api/verify-code', validatePhoneNumber, (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérifier si le code n'a pas expiré (5 minutes)
|
// Check if the code has not expired (5 minutes)
|
||||||
if (Date.now() - verification.timestamp > 5 * 60 * 1000) {
|
if (Date.now() - verification.timestamp > 5 * 60 * 1000) {
|
||||||
verificationCodes.delete(phoneNumber);
|
verificationCodes.delete(phoneNumber);
|
||||||
return res.status(400).json({
|
return res.status(400).json({
|
||||||
@ -193,7 +365,7 @@ app.post('/api/verify-code', validatePhoneNumber, (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérifier le code
|
// Check if the code is correct
|
||||||
if (verification.code.toString() === code.toString()) {
|
if (verification.code.toString() === code.toString()) {
|
||||||
verificationCodes.delete(phoneNumber);
|
verificationCodes.delete(phoneNumber);
|
||||||
res.json({
|
res.json({
|
||||||
@ -218,7 +390,6 @@ app.post('/api/verify-code', validatePhoneNumber, (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Démarrage du serveur
|
app.listen(PORT, () => {
|
||||||
app.listen(config.PORT, () => {
|
console.log(`Server is running on port ${PORT}`);
|
||||||
console.log(`Serveur démarré sur le port ${config.PORT}`);
|
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user