mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-10 06:34:41 +02:00
Initial real 2FA/OTP work
This commit is contained in:
parent
75d6eef92f
commit
0ed507cd7b
13 changed files with 133 additions and 39 deletions
|
@ -846,6 +846,7 @@ function peg$parse(input, options) {
|
|||
|
||||
const UserProps = require('./user_property.js');
|
||||
const Log = require('./logger.js').log;
|
||||
const User = require('./user.js');
|
||||
|
||||
const _ = require('lodash');
|
||||
const moment = require('moment');
|
||||
|
@ -982,6 +983,22 @@ function peg$parse(input, options) {
|
|||
SC : function isSecureConnection() {
|
||||
return _.get(client, 'session.isSecure', false);
|
||||
},
|
||||
AF : function currentAuthFactor() {
|
||||
if(!user) {
|
||||
return false;
|
||||
}
|
||||
return !isNaN(value) && user.authFactor >= value;
|
||||
},
|
||||
AR : function authFactorRequired() {
|
||||
if(!user) {
|
||||
return false;
|
||||
}
|
||||
switch(value) {
|
||||
case 1 : return user.authFactor >= User.AuthFactors.Factor1;
|
||||
case 2 : return user.authFactor >= User.AuthFActors.Factor2;
|
||||
default : return false;
|
||||
}
|
||||
},
|
||||
ML : function minutesLeft() {
|
||||
// :TODO: implement me!
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue