Return password reset link on reset request route

This commit is contained in:
Johannes Zellner
2021-09-16 14:34:56 +02:00
parent ecd35bd08d
commit 074ce574dd
3 changed files with 11 additions and 7 deletions

View File

@@ -80,10 +80,10 @@ async function logout(req, res) {
async function passwordResetRequest(req, res, next) {
if (!req.body.identifier || typeof req.body.identifier !== 'string') return next(new HttpError(401, 'A identifier must be non-empty string'));
const [error] = await safe(users.sendPasswordResetByIdentifier(req.body.identifier, auditSource.fromRequest(req)));
const [error, result] = await safe(users.sendPasswordResetByIdentifier(req.body.identifier, auditSource.fromRequest(req)));
if (error && error.reason !== BoxError.NOT_FOUND) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));
next(new HttpSuccess(202, { resetLink: result }));
}
async function passwordReset(req, res, next) {