mailparser.on("end", function (mailObject) { var content = mailObject.text; var resetCodeRegexp = new RegExp("https?://[^/]+/api/user/reset/([a-z0-9-]+)", "i"); var matches = content.toString().match(resetCodeRegexp); jqUnit.assertNotNull("There should be a reset code in the email sent to the user.", matches); if (matches) { var code = matches[1]; resetRequest.options.path = fluid.stringTemplate(resetRequest.options.path, { code: code}); resetRequest.send({ password: resetRequest.options.user.password, confirm: resetRequest.options.user.password}); } });
gpii.express.user.api.reset.test.caseHolder.checkResetCode = function (code) { jqUnit.assertNotNull("There should be a verification code in the email sent to the user.", code); return code; };