register remaining part
This commit is contained in:
parent
aa66a6b792
commit
ef3ddc6669
@ -3,6 +3,8 @@
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import Patient from './PatientModel.js'
|
import Patient from './PatientModel.js'
|
||||||
import { sendOtp } from '../../Utils/sendEmail.js';
|
import { sendOtp } from '../../Utils/sendEmail.js';
|
||||||
|
import validator from "validator";
|
||||||
|
|
||||||
export const register = async (req, res) => {
|
export const register = async (req, res) => {
|
||||||
let { name, countryCode, mobileNumber } = req.body;
|
let { name, countryCode, mobileNumber } = req.body;
|
||||||
// Trim the country code and mobile number
|
// Trim the country code and mobile number
|
||||||
@ -118,6 +120,13 @@ export const create1RegistrationDetails = async (req, res) => {
|
|||||||
password,
|
password,
|
||||||
confirmPassword,
|
confirmPassword,
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
if (!email) return res.status(400).json({ message: 'Email is required' });
|
||||||
|
if (!password) return res.status(400).json({ message: 'Password is required' });
|
||||||
|
if (!confirmPassword) return res.status(400).json({ message: 'Confirm password is required' });
|
||||||
|
// Validate email format
|
||||||
|
if (!validator.isEmail(email)) {
|
||||||
|
return res.status(400).json({ message: 'Invalid email format' });
|
||||||
|
}
|
||||||
const patientId = req.cookies.patientId;
|
const patientId = req.cookies.patientId;
|
||||||
if (!patientId) {
|
if (!patientId) {
|
||||||
return res.status(400).json({ message: 'Patient did not registered Or verified' });
|
return res.status(400).json({ message: 'Patient did not registered Or verified' });
|
||||||
|
Loading…
Reference in New Issue
Block a user