// USER DEACTIVATE ACCOUNT app.post('/user/deactivate-account', async (req, res) => { let { id } = req.session, userPassword = await User.getWhat('password', id), { password } = req.body, samePassword = await User.comparePassword(password, userPassword) req.checkBody('password', 'Password is empty!!').notEmpty() let errors = await req.getValidationResult() if (!errors.isEmpty()) { let array = [] errors.array().forEach(e => array.push(e.msg)) res.json({ mssg: array }) } else if (!samePassword) { res.json({ mssg: 'Wrong password!!' }) } else { await User.deactivate(id, req, res) res.json({ mssg: 'Deactivated your account successfully!!', success: true, }) } })
if (!errors.isEmpty()) { let array = [] errors.array().forEach(e => array.push(e.msg)) res.json({ mssg: array }) } else {
if (!errors.isEmpty()) { let array = [] errors.array().forEach(e => array.push(e.msg)) res.json({ mssg: array }) } else {
if (!errors.isEmpty()) { let array = [] errors.array().forEach(e => array.push(e.msg)) res.json({ mssg: array }) } else {
if (!errors.isEmpty()) { let array = [] errors.array().forEach(e => array.push(e.msg)) res.json({ mssg: array }) } else {
if (!errors.isEmpty()) { let array = [] errors.array().forEach(e => array.push(e.msg)) res.json({ mssg: array }) } else {
if (!errors.isEmpty()) { let array = [] errors.array().forEach(e => array.push(e.msg)) res.json({ mssg: array }) } else {