Lookup for email in username field to match docs if email is undefined (#2732)

* Lookup for email in username field to match docs if email is undefined

* Adds support for sendMail option to when email is selected

* Proper does not exists clause
This commit is contained in:
Florent Vilmart
2016-09-18 18:32:34 -04:00
committed by GitHub
parent 7e037ffa72
commit e30989c7d3
3 changed files with 53 additions and 3 deletions

View File

@@ -2,9 +2,20 @@ module.exports = options => {
if (!options) {
throw "Options were not provided"
}
return {
let adapter = {
sendVerificationEmail: () => Promise.resolve(),
sendPasswordResetEmail: () => Promise.resolve(),
sendMail: () => Promise.resolve()
};
if (options.sendMail) {
adapter.sendMail = options.sendMail
}
if (options.sendPasswordResetEmail) {
adapter.sendPasswordResetEmail = options.sendPasswordResetEmail
}
if (options.sendVerificationEmail) {
adapter.sendVerificationEmail = options.sendVerificationEmail;
}
return adapter;
}