Better e-mail adapter testing (#2208)

This commit is contained in:
Tyler Brock
2016-07-05 12:08:46 -07:00
committed by GitHub
parent 48b33d3889
commit 2f2ff377eb
3 changed files with 97 additions and 8 deletions

View File

@@ -83,13 +83,14 @@ export class Config {
}
static validateEmailConfiguration({emailAdapter, appName, publicServerURL}) {
if (emailAdapter) {
if (typeof appName !== 'string') {
throw 'An app name is required for e-mail verification and password resets.';
}
if (typeof publicServerURL !== 'string') {
throw 'A public server url is required for e-mail verification and password resets.';
}
if (!emailAdapter) {
throw 'An emailAdapter is required for e-mail verification and password resets.';
}
if (typeof appName !== 'string') {
throw 'An app name is required for e-mail verification and password resets.';
}
if (typeof publicServerURL !== 'string') {
throw 'A public server url is required for e-mail verification and password resets.';
}
}

View File

@@ -163,7 +163,7 @@ export class UsersRouter extends ClassesRouter {
handleResetRequest(req) {
try {
Config.validateEmailConfiguration({
emailAdapter: req.config.userController,
emailAdapter: req.config.userController.adapter,
appName: req.config.appName,
publicServerURL: req.config.publicServerURL,
});