remove redundant user check in deleteUser
This commit is contained in:
1 parent
084ef9b952
commit
bc8e509b17
1 file changed
-7
@@ -350,7 +350,6 @@ const requestRecovery = async (req, res, next) => {
|
|||||||
const name = user.firstName;
|
const name = user.firstName;
|
||||||
const { clientHost } = req.settingsService.getSettings();
|
const { clientHost } = req.settingsService.getSettings();
|
||||||
const url = `${clientHost}/set-new-password/${recoveryToken.token}`;
|
const url = `${clientHost}/set-new-password/${recoveryToken.token}`;
|
||||||
|
|
||||||
const msgId = await req.emailService.buildAndSendEmail(
|
const msgId = await req.emailService.buildAndSendEmail(
|
||||||
"passwordResetTemplate",
|
"passwordResetTemplate",
|
||||||
{
|
{
|
||||||
@@ -425,7 +424,6 @@ const resetPassword = async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const user = await req.db.resetPassword(req, res);
|
const user = await req.db.resetPassword(req, res);
|
||||||
|
|
||||||
const appSettings = await req.settingsService.getSettings();
|
const appSettings = await req.settingsService.getSettings();
|
||||||
const token = issueToken(user._doc, tokenType.ACCESS_TOKEN, appSettings);
|
const token = issueToken(user._doc, tokenType.ACCESS_TOKEN, appSettings);
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
@@ -455,11 +453,6 @@ const deleteUser = async (req, res, next) => {
|
|||||||
|
|
||||||
// Check if the user exists
|
// Check if the user exists
|
||||||
const user = await req.db.getUserByEmail(email);
|
const user = await req.db.getUserByEmail(email);
|
||||||
if (!user) {
|
|
||||||
next(new Error(errorMessages.DB_USER_NOT_FOUND));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1. Find all the monitors associated with the team ID if superadmin
|
// 1. Find all the monitors associated with the team ID if superadmin
|
||||||
|
|
||||||
const result = await req.db.getMonitorsByTeamId({
|
const result = await req.db.getMonitorsByTeamId({
|
||||||
|
|||||||
Reference in new issue
Block a user