mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
18 lines
652 B
TypeScript
18 lines
652 B
TypeScript
|
|
||
|
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 () {
|
||
|
const authSession = AuthenticationSession.get(req);
|
||
|
if (!authSession.second_factor)
|
||
|
return BluebirdPromise.reject("No second factor variable");
|
||
|
|
||
|
return BluebirdPromise.resolve();
|
||
|
});
|
||
|
}
|