Good progress on 2FA/OTP config

This commit is contained in:
Bryan Ashby 2019-05-24 22:27:50 -06:00
parent b62f55961f
commit 8802ae24ba
No known key found for this signature in database
GPG key ID: B49EB437951D2542
7 changed files with 230 additions and 10 deletions

View file

@ -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,