Skip to content

Commit ee4ab76

Browse files
committed
Keep otp_recovery out of the session
1 parent d1d5bfe commit ee4ab76

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

interface/web/login/index.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ function process_login_request(app $app, &$error, $conf, $module)
148148
$_SESSION['otp']['session_attempts'] = 0;
149149
$_SESSION['otp']['type'] = $user['otp_type'];
150150
$_SESSION['otp']['data'] = $user['otp_data'];
151-
$_SESSION['otp']['recovery'] = $user['otp_recovery'];
152151

153152
//* Redirect to otp script
154153
header('Location: otp.php');

interface/web/login/otp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ function finish_2fa_success($msg = '') {
7676
}
7777

7878
//* Handle recovery code
79-
if(isset($_POST['code']) && strlen($_POST['code']) == $otp_recovery_code_length && $_SESSION['otp']['recovery']) {
79+
if(isset($_POST['code']) && strlen($_POST['code']) == $otp_recovery_code_length) {
8080
//* TODO Recovery code handling
8181

82-
$user = $app->db->queryOneRecord('SELECT otp_attempts FROM sys_user WHERE userid = ?',$_SESSION['s_pending']['user']['userid']);
82+
$user = $app->db->queryOneRecord('SELECT otp_attempts, otp_recovery FROM sys_user WHERE userid = ?',$_SESSION['s_pending']['user']['userid']);
8383

8484
//* We allow one more try to enter recovery code
8585
if($user['otp_attempts'] > $max_global_code_retry + 1) {

0 commit comments

Comments
 (0)