2017-05-25 20:09:29 +07:00
|
|
|
|
|
|
|
import BluebirdPromise = require("bluebird");
|
|
|
|
import express = require("express");
|
|
|
|
import objectPath = require("object-path");
|
|
|
|
|
|
|
|
import FirstFactorValidator = require("./FirstFactorValidator");
|
|
|
|
import AuthenticationSession = require("./AuthenticationSession");
|
|
|
|
|
|
|
|
export function validate(req: express.Request): BluebirdPromise<void> {
|
|
|
|
return FirstFactorValidator.validate(req)
|
|
|
|
.then(function () {
|
2017-09-22 03:07:34 +07:00
|
|
|
return AuthenticationSession.get(req);
|
|
|
|
})
|
|
|
|
.then(function (authSession: AuthenticationSession.AuthenticationSession) {
|
2017-05-25 20:09:29 +07:00
|
|
|
if (!authSession.second_factor)
|
2017-09-22 03:07:34 +07:00
|
|
|
return BluebirdPromise.reject("No second factor variable.");
|
2017-05-25 20:09:29 +07:00
|
|
|
return BluebirdPromise.resolve();
|
|
|
|
});
|
|
|
|
}
|