Improves validation of email parameters in Configuration

This commit is contained in:
Florent Vilmart
2016-02-28 00:15:59 -05:00
parent 2183b0be82
commit 6aa38ea8ca
4 changed files with 34 additions and 30 deletions

View File

@@ -16,8 +16,8 @@ export class AdaptableController {
constructor(adapter, appId, options) {
this.options = options;
this.adapter = adapter;
this.appId = appId;
this.adapter = adapter;
}
set adapter(adapter) {
@@ -62,8 +62,7 @@ export class AdaptableController {
}, {});
if (Object.keys(mismatches).length > 0) {
console.error(adapter, mismatches);
throw new Error("Adapter prototype don't match expected prototype");
throw new Error("Adapter prototype don't match expected prototype", adapter, mismatches);
}
}
}

View File

@@ -162,16 +162,12 @@ export class UserController extends AdaptableController {
const token = encodeURIComponent(user._perishable_token);
const username = encodeURIComponent(user.username);
let link = `${this.config.requestResetPasswordURL}?token=${token}&username=${username}`
if (!user.username) {
console.log('No username...');
}
let options = {
appName: this.config.appName,
link: link,
user: inflate('_User', user),
};
appName: this.config.appName,
link: link,
user: inflate('_User', user),
};
if (this.adapter.sendPasswordResetEmail) {
this.adapter.sendPasswordResetEmail(options);