feat(User/Auth): Use stand alone auth token

This commit is contained in:
Berkeley Martinez
2017-12-29 09:59:27 -08:00
committed by mrugesh mohapatra
parent 7a922229f4
commit 07f30427cb
6 changed files with 51 additions and 5 deletions

View File

@ -483,6 +483,12 @@ module.exports = function(User) {
}
);
User.prototype.createAuthToken = function createAuthToken({ ttl } = {}) {
return Observable.fromNodeCallback(
this.authTokens.create.bind(this.authTokens)
)({ ttl });
};
User.prototype.getEncodedEmail = function getEncodedEmail() {
if (!this.email) {
return null;
@ -506,7 +512,7 @@ module.exports = function(User) {
}
// create a temporary access token with ttl for 15 minutes
return this.createAccessToken$({ ttl: 15 * 60 * 1000 });
return this.createAuthToken({ ttl: 15 * 60 * 1000 });
})
.flatMap(token => {
let renderAuthEmail = renderSignInEmail;