Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 2x 2x 2x | import UsersController from '../../controllers/users-controllers/UsersController.js';
import ErrorGenerator from '../../utilities/ErrorGenerator.js';
import asyncRouteHandler from '../../utilities/asyncRouteHandler.js';
export default asyncRouteHandler(
async function user_changePassword_post(req, res, next) {
const respond = await UsersController.changePassword(req.userId, req.body);
if (respond) {
res.status(200).json(respond);
} else E{
const message = respond === null
? "You have changed your password since less than a month, You can't change it again, Try again after a month since last change"
: "Unexpected Error!"
next(new ErrorGenerator(message, 400));
}
}
) |