@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | use Symfony\Component\HttpFoundation\Request as SymfonyRequest; |
| 34 | 34 | |
| 35 | 35 | // Load functions |
| 36 | -require_once __DIR__. '/includes/config/include.php'; |
|
| 36 | +require_once __DIR__.'/includes/config/include.php'; |
|
| 37 | 37 | require_once __DIR__.'/sources/main.functions.php'; |
| 38 | 38 | |
| 39 | 39 | // init |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | // Check for existing lock |
| 54 | 54 | $result = DB::queryFirstField( |
| 55 | 55 | 'SELECT 1 |
| 56 | - FROM ' . prefixTable('auth_failures') . ' |
|
| 56 | + FROM ' . prefixTable('auth_failures').' |
|
| 57 | 57 | WHERE unlock_at = ( |
| 58 | 58 | SELECT MAX(unlock_at) |
| 59 | - FROM ' . prefixTable('auth_failures') . ' |
|
| 59 | + FROM ' . prefixTable('auth_failures').' |
|
| 60 | 60 | WHERE unlock_at > %s |
| 61 | 61 | AND source = %s AND value = %s) |
| 62 | 62 | AND unlock_code = %s', |
@@ -2663,7 +2663,7 @@ |
||
| 2663 | 2663 | 'SELECT email, name |
| 2664 | 2664 | FROM '.prefixTable('users').' |
| 2665 | 2665 | WHERE login = %s', |
| 2666 | - $value |
|
| 2666 | + $value |
|
| 2667 | 2667 | ); |
| 2668 | 2668 | |
| 2669 | 2669 | // No valid email address for user |
@@ -2401,7 +2401,9 @@ discard block |
||
| 2401 | 2401 | // Complete $userInfo |
| 2402 | 2402 | $userInfo['has_been_created'] = 1; |
| 2403 | 2403 | |
| 2404 | - if (WIP === true) error_log("--- USER CREATED ---"); |
|
| 2404 | + if (WIP === true) { |
|
| 2405 | + error_log("--- USER CREATED ---"); |
|
| 2406 | + } |
|
| 2405 | 2407 | |
| 2406 | 2408 | return [ |
| 2407 | 2409 | 'error' => false, |
@@ -2437,7 +2439,9 @@ discard block |
||
| 2437 | 2439 | } |
| 2438 | 2440 | |
| 2439 | 2441 | // Oauth2 user already exists and authenticated |
| 2440 | - if (WIP === true) error_log("--- USER AUTHENTICATED ---"); |
|
| 2442 | + if (WIP === true) { |
|
| 2443 | + error_log("--- USER AUTHENTICATED ---"); |
|
| 2444 | + } |
|
| 2441 | 2445 | $userInfo['has_been_created'] = 0; |
| 2442 | 2446 | |
| 2443 | 2447 | $passwordManager = new PasswordManager(); |
@@ -2667,8 +2671,9 @@ discard block |
||
| 2667 | 2671 | ); |
| 2668 | 2672 | |
| 2669 | 2673 | // No valid email address for user |
| 2670 | - if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) |
|
| 2671 | - return; |
|
| 2674 | + if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) { |
|
| 2675 | + return; |
|
| 2676 | + } |
|
| 2672 | 2677 | |
| 2673 | 2678 | $unlock_url = $SETTINGS['cpassman_url'].'/self-unlock.php?login='.$value.'&otp='.$unlock_code; |
| 2674 | 2679 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ) { |
| 78 | 78 | // Not allowed page |
| 79 | 79 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
| 80 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 80 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 81 | 81 | exit; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if (isset($order['column']) && preg_match('#^(asc|desc)$#i', $order['dir'])) { |
| 129 | 129 | $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT); |
| 130 | 130 | $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 131 | - $sOrder .= $aColumns[$columnIndex] . ' ' . $dir . ', '; |
|
| 131 | + $sOrder .= $aColumns[$columnIndex].' '.$dir.', '; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $sOrder = substr_replace($sOrder, '', -2); |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | if ($letter !== '' && $letter !== 'None') { |
| 154 | 154 | $sWhere .= ' AND ('; |
| 155 | - $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR "; |
|
| 156 | - $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR "; |
|
| 157 | - $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' "; |
|
| 155 | + $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR "; |
|
| 156 | + $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR "; |
|
| 157 | + $sWhere .= $aColumns[3]." LIKE '".$letter."%' "; |
|
| 158 | 158 | $sWhere .= ')'; |
| 159 | 159 | } elseif ($searchValue !== '') { |
| 160 | 160 | $sWhere .= ' AND ('; |
| 161 | - $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR "; |
|
| 162 | - $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR "; |
|
| 163 | - $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' "; |
|
| 161 | + $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR "; |
|
| 162 | + $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR "; |
|
| 163 | + $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' "; |
|
| 164 | 164 | $sWhere .= ')'; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | // Check for existing lock |
| 248 | 248 | $unlock_at = DB::queryFirstField( |
| 249 | 249 | 'SELECT MAX(unlock_at) |
| 250 | - FROM ' . prefixTable('auth_failures') . ' |
|
| 250 | + FROM ' . prefixTable('auth_failures').' |
|
| 251 | 251 | WHERE unlock_at > %s AND source = %s AND value = %s', |
| 252 | 252 | date('Y-m-d H:i:s', time()), |
| 253 | 253 | 'login', |
@@ -256,33 +256,31 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | // Get some infos about user |
| 258 | 258 | $userDisplayInfos = |
| 259 | - (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '') |
|
| 259 | + (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '') |
|
| 260 | 260 | . |
| 261 | 261 | ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.$lang->get('index_last_seen').": ". |
| 262 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '') |
|
| 262 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '') |
|
| 263 | 263 | . |
| 264 | 264 | ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.$lang->get('ip').": ".($record['user_ip']).'\"></i>' : '') |
| 265 | 265 | . |
| 266 | 266 | ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.$lang->get('managed_through_ad').'\"></i>' : '') |
| 267 | 267 | . |
| 268 | 268 | ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ? |
| 269 | - ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : |
|
| 270 | - '' |
|
| 269 | + ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : '' |
|
| 271 | 270 | ) |
| 272 | 271 | . |
| 273 | 272 | (($unlock_at) ? '<i class=\"fas fa-solid text-red fa-lock infotip text-info ml-1\" title=\"'.$lang->get('bruteforce_unlock_at').$unlock_at.'\"></i>' : ''); |
| 274 | 273 | if ($request->query->filter('display_warnings', '', FILTER_VALIDATE_BOOLEAN) === true) { |
| 275 | 274 | $userDisplayInfos .= '<br>'. |
| 276 | 275 | ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? |
| 277 | - '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : |
|
| 278 | - '' |
|
| 276 | + '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : '' |
|
| 279 | 277 | ). |
| 280 | 278 | ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['pw_passwordlib'] === 1) ? '<i class=\"fa-solid fa-person-walking-luggage infotip ml-1\" style=\"color:Tomato\" title=\"Old password encryption. Shall login to initialize.\"></i>' : ''); |
| 281 | 279 | } |
| 282 | 280 | |
| 283 | 281 | $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'. |
| 284 | - (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').' '. |
|
| 285 | - (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : ''). |
|
| 282 | + (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').' '. |
|
| 283 | + (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : ''). |
|
| 286 | 284 | '\" data-auth-type=\"'.$record['auth_type'].'\" data-special=\"'.$record['special'].'\" data-mfa-enabled=\"'.$record['mfa_enabled'].'\" data-otp-provided=\"'.(isset($record['otp_provided']) === true ? $record['otp_provided'] : '').'\"></span>", '; |
| 287 | 285 | //col2 |
| 288 | 286 | $sOutput .= '"'. |