Better e-mail adapter testing (#2208)
This commit is contained in:
@@ -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.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user