/
factores-voice.php
57 lines (56 loc) · 1.42 KB
/
factores-voice.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
session_start();
include 'Services/Twilio.php';
include 'config.php';
include 'functions.php';
$username = cleanVar('username');
$password = cleanVar('password');
$phoneNum = cleanVar('phone_number');
if( isset($_POST['action']) ){
if( isset($_POST['username']) &&
isset($_POST['phone_number'])
){
$message = user_generate_token($username,
$phoneNum,'calls');
}else if( isset($_POST['username']) &&
isset($_POST['password']) ){
$message = user_login($username, $password);
}
header("Location: two-factor-voice.php?message=" .
urlencode($message));
exit;
}
?>
<html>
<body>
<p>Please enter a username, and a phone number you can be
reached at, we will then call you with your one-time
password</p>
<span id="message">
<?php
echo cleanVar('message');
$action = (isset($_SESSION['password'])) ? 'login' :
'token';
?>
</span>
<form id="reset-form" method="POST" class="center">
<input type="hidden" name="action" value="<?php echo
$action;
?>" />
<p>Username: <input type="text" name="username"
id="username"
value="<?php echo $_SESSION['username']; ?>" /></p>
<?php if (isset($_SESSION['password'])) { ?>
<p>Password: <input type="password" name="password"
id="password" /></p>
<?php } else { ?>
<p>Phone Number: <input type="text" name="phone_number"
id="phone_number" /></p>
<input type="hidden" name="method" value="voice" />
<?php } ?>
<p><input type="submit" name="submit" id="submit"
value="login!"/></p>
<p> </p>
</form>
</body>
</html>