Skip to content

Commit febd6ab

Browse files
committed
Better use random_int
1 parent e748c8b commit febd6ab

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

interface/web/login/otp.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ function finish_2fa_success($msg = '') {
129129

130130
//* set code
131131
if(!isset($_SESSION['otp']['code']) || empty($_SESSION['otp']['code'])) {
132-
// Random int between 10^($code_length-1) and 10^$code_length
133-
$_SESSION['otp']['code'] = rand(pow(10, $code_length - 1), pow(10, $code_length) - 1);
132+
$_SESSION['otp']['code'] = random_int(100000, 999999);
134133
$_SESSION['otp']['starttime'] = time();
135134
}
136135

0 commit comments

Comments
 (0)