mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
Good progress on 2FA/OTP config
This commit is contained in:
parent
b62f55961f
commit
8802ae24ba
7 changed files with 230 additions and 10 deletions
|
@ -372,12 +372,28 @@ function twoFactorAuthOTP(user) {
|
|||
prepareOTP,
|
||||
} = require('../../core/user_2fa_otp.js');
|
||||
|
||||
let otpType = argv._[argv._.length - 1];
|
||||
|
||||
// shortcut for removal
|
||||
if('disable' === otpType) {
|
||||
const props = [
|
||||
UserProps.AuthFactor2OTP,
|
||||
UserProps.AuthFactor2OTPSecret,
|
||||
UserProps.AuthFactor2OTPBackupCodes,
|
||||
];
|
||||
return user.removeProperties(props, err => {
|
||||
if(err) {
|
||||
console.error(err.message);
|
||||
} else {
|
||||
console.info(`2FA OTP disabled for ${user.username}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async.waterfall(
|
||||
[
|
||||
function validate(callback) {
|
||||
// :TODO: Prompt for if not supplied
|
||||
let otpType = argv._[argv._.length - 1];
|
||||
|
||||
// allow aliases for OTP types
|
||||
otpType = {
|
||||
google : OTPTypes.GoogleAuthenticator,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue