Updated 2FA UI

This commit is contained in:
root
2019-06-16 23:56:40 -04:00
parent e247ad4ee4
commit b65739bfc3
3 changed files with 33 additions and 28 deletions

View File

@@ -6,15 +6,10 @@
<div class="card mb-3">
<div class="card-header">
<h6 class="float-left mt-1"><i class="fa fa-fw fa-cog mr-2"></i>User Settings</h6>
<h6 class="float-left mt-1"><i class="fa fa-fw fa-lock mr-2"></i>Two Factor Authentication</h6>
</div>
<div class="card-body">
<form class="p-3" action="post.php" method="post" autocomplete="off">
<input type="hidden" name="secretkey" value="<?php echo $secret_key; ?>">
<div class="custom-control custom-switch mb-2">
<input type="checkbox" class="custom-control-input" name="en2fa" <?php if($en2fa == 1){ echo "checked"; } ?> value="1" id="customSwitch1">
<label class="custom-control-label" for="customSwitch1">Enable Two Factor Authentication</label>
</div>
<?php
@@ -23,22 +18,29 @@
//Generate a base32 Key
$secretkey = key32gen();
//Generate QR Code based off the generated key
print sprintf('<img src="%s"/>',TokenAuth6238::getBarCodeUrl('','',$secretkey,'PittPC-CRM'));
if(!empty($session_token)){
//Generate QR Code based off the generated key
print sprintf('<img src="%s"/>',TokenAuth6238::getBarCodeUrl('','',$session_token,'PittPC-CRM'));
}
?>
<input type="hidden" name="token" value="<?php echo $secretkey; ?>">
<hr>
<button type="submit" name="settings_2fa" class="btn btn-primary">Enable</button>
<?php if(empty($session_token)){ ?>
<button type="submit" name="enable_2fa" class="btn btn-primary">Enable 2FA</button>
<?php }else{ ?>
<button type="submit" name="disable_2fa" class="btn btn-danger">Disable 2FA</button>
<?php } ?>
</form>
<hr>
<?php if(!empty($session_token)){ ?>
<form class="p-3" action="post.php" method="post" autocomplete="off">
<div class="form-group">
<label>Enter Code</label>
<label>Verify 2FA is Working</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
@@ -48,10 +50,8 @@
</div>
<hr>
<button type="submit" name="verify" class="btn btn-primary">Verify</button>
</form>
<?php } ?>
</div>
</div>