<?php
	include_once $_SERVER['DOCUMENT_ROOT'].'/core/func/includes.php';
	if (!$GLOBALS['loggedIn'] or $GLOBALS['userTable']['2faEnabled'] == 0 or $GLOBALS['sessionTable']['factorFinish'] == 1) {
		header("Location: /");
		exit;
	}
?>
<!DOCTYPE html>
<html>
	<head>
		<title><?php echo config::getName();?> | Two Step Authentication</title>
		<?php html::buildHead();?>
	</head>
	<body>
		<?php html::getNavigation();?>
		<script src="/core/func/js/auth/twostep.js?v=2"></script>
		<div class="container">
			<div class="col-xs-12 col-sm-8 col-md-8 col-sm-offset-2 col-md-offset-2">
				<div id="tStatus"></div>
				<div class="well profileCard">
					<h4>Two Step Authentication</h4>
					<p style="color:grey">Sign in with the authentication code generated by your mobile app</p>
					<input class="form-control" type="text" placeholder="Authentication code here" id="factorCode"></input>
					<button id="finishAuth" class="btn btn-primary fullWidth">Authenticate</button>
				</div>
				<p style="color:grey;text-align:center">If you need help, please contact <a href="mailto:support@xdiscuss.net">support@xdiscuss.net</a> and we will gladly help you</p>
			</div>
		</div>
		<?php html::buildFooter();?>
	</body>
</html>