|
@@ -44,16 +44,16 @@ discard block |
|
|
block discarded – undo |
|
44
|
44
|
throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
|
45
|
45
|
} |
|
46
|
46
|
|
|
47
|
|
-if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
|
47
|
+if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
48
|
48
|
$SETTINGS = []; |
|
49
|
49
|
$SETTINGS['cpassman_dir'] = '..'; |
|
50
|
50
|
} |
|
51
|
51
|
|
|
52
|
52
|
// Load libraries |
|
53
|
|
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
54
|
|
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
55
|
|
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
56
|
|
-include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
53
|
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
|
54
|
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
|
55
|
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
|
56
|
+include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
57
|
57
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
58
|
58
|
|
|
59
|
59
|
// Prepare POST variables |
|
@@ -66,7 +66,7 @@ discard block |
|
|
block discarded – undo |
|
66
|
66
|
if (defined('DB_PASSWD_CLEAR') === false) { |
|
67
|
67
|
define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
|
68
|
68
|
} |
|
69
|
|
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
|
69
|
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
70
|
70
|
if (defined('DB_PASSWD_CLEAR') === false) { |
|
71
|
71
|
define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
|
72
|
72
|
} |
|
@@ -88,12 +88,12 @@ discard block |
|
|
block discarded – undo |
|
88
|
88
|
defineComplexity(); |
|
89
|
89
|
|
|
90
|
90
|
// Load superGlobals |
|
91
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
91
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
92
|
92
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
93
|
93
|
|
|
94
|
94
|
// If Debug then clean the files |
|
95
|
95
|
if (DEBUGLDAP === true) { |
|
96
|
|
- define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt'); |
|
|
96
|
+ define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt'); |
|
97
|
97
|
file_put_contents(DEBUGLDAPFILE, ''); |
|
98
|
98
|
} |
|
99
|
99
|
|
|
@@ -180,19 +180,19 @@ discard block |
|
|
block discarded – undo |
|
180
|
180
|
if (findTpConfigFile() === false) { |
|
181
|
181
|
throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
|
182
|
182
|
} |
|
183
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
184
|
|
- include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
185
|
|
- include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
|
183
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
|
184
|
+ include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
|
185
|
+ include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
186
|
186
|
|
|
187
|
187
|
header('Content-type: text/html; charset=utf-8'); |
|
188
|
188
|
error_reporting(E_ERROR); |
|
189
|
189
|
|
|
190
|
190
|
// Load AntiXSS |
|
191
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
|
191
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
192
|
192
|
$antiXss = new voku\helper\AntiXSS(); |
|
193
|
193
|
|
|
194
|
194
|
// Load superGlobals |
|
195
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
195
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
196
|
196
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
197
|
197
|
|
|
198
|
198
|
// Prepare GET variables |
|
@@ -206,7 +206,7 @@ discard block |
|
|
block discarded – undo |
|
206
|
206
|
$server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER'); |
|
207
|
207
|
|
|
208
|
208
|
// connect to the server |
|
209
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
|
209
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
210
|
210
|
DB::$host = DB_HOST; |
|
211
|
211
|
DB::$user = DB_USER; |
|
212
|
212
|
DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR; |
|
@@ -216,7 +216,7 @@ discard block |
|
|
block discarded – undo |
|
216
|
216
|
DB::$ssl = DB_SSL; |
|
217
|
217
|
DB::$connect_options = DB_CONNECT_OPTIONS; |
|
218
|
218
|
// User's language loading |
|
219
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php'; |
|
|
219
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php'; |
|
220
|
220
|
|
|
221
|
221
|
// decrypt and retreive data in JSON format |
|
222
|
222
|
if (empty($sessionKey) === true) { |
|
@@ -232,18 +232,18 @@ discard block |
|
|
block discarded – undo |
|
232
|
232
|
} |
|
233
|
233
|
|
|
234
|
234
|
// Check if Duo auth is in progress and pass the pw and login back to the standard login process |
|
235
|
|
- if( |
|
|
235
|
+ if ( |
|
236
|
236
|
isKeyExistingAndEqual('duo', 1, $SETTINGS) === true |
|
237
|
237
|
&& $dataReceived['user_2fa_selection'] === 'duo' |
|
238
|
|
- && $superGlobal->get('duo_status','SESSION') === 'IN_PROGRESS' |
|
|
238
|
+ && $superGlobal->get('duo_status', 'SESSION') === 'IN_PROGRESS' |
|
239
|
239
|
&& !empty($dataReceived['duo_state']) |
|
240
|
|
- ){ |
|
|
240
|
+ ) { |
|
241
|
241
|
$key = hash('sha256', $dataReceived['duo_state']); |
|
242
|
242
|
$iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16); |
|
243
|
|
- $duo_data_dec = openssl_decrypt(base64_decode($superGlobal->get('duo_data','SESSION')), 'AES-256-CBC', $key, 0, $iv); |
|
|
243
|
+ $duo_data_dec = openssl_decrypt(base64_decode($superGlobal->get('duo_data', 'SESSION')), 'AES-256-CBC', $key, 0, $iv); |
|
244
|
244
|
// Clear the data from the Duo process to continue clean with the standard login process |
|
245
|
|
- $superGlobal->forget('duo_data','SESSION'); |
|
246
|
|
- if($duo_data_dec === false){ |
|
|
245
|
+ $superGlobal->forget('duo_data', 'SESSION'); |
|
|
246
|
+ if ($duo_data_dec === false) { |
|
247
|
247
|
echo prepareExchangedData( |
|
248
|
248
|
$SETTINGS['cpassman_dir'], |
|
249
|
249
|
[ |
|
@@ -259,7 +259,7 @@ discard block |
|
|
block discarded – undo |
|
259
|
259
|
$dataReceived['login'] = $duo_data['duo_login']; |
|
260
|
260
|
} |
|
261
|
261
|
|
|
262
|
|
- if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) { |
|
|
262
|
+ if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) { |
|
263
|
263
|
echo json_encode([ |
|
264
|
264
|
'data' => prepareExchangedData( |
|
265
|
265
|
$SETTINGS['cpassman_dir'], |
|
@@ -566,7 +566,7 @@ discard block |
|
|
block discarded – undo |
|
566
|
566
|
} |
|
567
|
567
|
// Append with roles from AD groups |
|
568
|
568
|
if (is_null($userInfo['roles_from_ad_groups']) === false) { |
|
569
|
|
- $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups']; |
|
|
569
|
+ $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups']; |
|
570
|
570
|
} |
|
571
|
571
|
// store |
|
572
|
572
|
$superGlobal->put('fonction_id', $userInfo['fonction_id'], 'SESSION'); |
|
@@ -577,7 +577,7 @@ discard block |
|
|
block discarded – undo |
|
577
|
577
|
if (count($superGlobal->get('user_roles', 'SESSION')) > 0) { |
|
578
|
578
|
$rolesList = DB::query( |
|
579
|
579
|
'SELECT id, title, complexity |
|
580
|
|
- FROM ' . prefixTable('roles_title') . ' |
|
|
580
|
+ FROM ' . prefixTable('roles_title').' |
|
581
|
581
|
WHERE id IN %li', |
|
582
|
582
|
$superGlobal->get('user_roles', 'SESSION') |
|
583
|
583
|
); |
|
@@ -600,7 +600,7 @@ discard block |
|
|
block discarded – undo |
|
600
|
600
|
|
|
601
|
601
|
// build complete array of roles |
|
602
|
602
|
$superGlobal->put('arr_roles_full', [], 'SESSION'); |
|
603
|
|
- $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
|
603
|
+ $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
604
|
604
|
foreach ($rows as $record) { |
|
605
|
605
|
$superGlobal->put( |
|
606
|
606
|
$record['id'], |
|
@@ -667,10 +667,10 @@ discard block |
|
|
block discarded – undo |
|
667
|
667
|
$superGlobal->put('latest_items_tab', [], 'SESSION'); |
|
668
|
668
|
$superGlobal->put('nb_roles', 0, 'SESSION'); |
|
669
|
669
|
foreach ($superGlobal->get('latest_items', 'SESSION') as $item) { |
|
670
|
|
- if (! empty($item)) { |
|
|
670
|
+ if (!empty($item)) { |
|
671
|
671
|
$dataLastItems = DB::queryFirstRow( |
|
672
|
672
|
'SELECT id,label,id_tree |
|
673
|
|
- FROM ' . prefixTable('items') . ' |
|
|
673
|
+ FROM ' . prefixTable('items').' |
|
674
|
674
|
WHERE id=%i', |
|
675
|
675
|
$item |
|
676
|
676
|
); |
|
@@ -679,7 +679,7 @@ discard block |
|
|
block discarded – undo |
|
679
|
679
|
[ |
|
680
|
680
|
'id' => $item, |
|
681
|
681
|
'label' => $dataLastItems['label'], |
|
682
|
|
- 'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item, |
|
|
682
|
+ 'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item, |
|
683
|
683
|
], |
|
684
|
684
|
'SESSION', |
|
685
|
685
|
'latest_items_tab' |
|
@@ -695,12 +695,12 @@ discard block |
|
|
block discarded – undo |
|
695
|
695
|
) { |
|
696
|
696
|
// get all Admin users |
|
697
|
697
|
$receivers = ''; |
|
698
|
|
- $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1); |
|
|
698
|
+ $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1); |
|
699
|
699
|
foreach ($rows as $record) { |
|
700
|
700
|
if (empty($receivers)) { |
|
701
|
701
|
$receivers = $record['email']; |
|
702
|
702
|
} else { |
|
703
|
|
- $receivers = ',' . $record['email']; |
|
|
703
|
+ $receivers = ','.$record['email']; |
|
704
|
704
|
} |
|
705
|
705
|
} |
|
706
|
706
|
// Add email to table |
|
@@ -716,7 +716,7 @@ discard block |
|
|
block discarded – undo |
|
716
|
716
|
'#tp_time#', |
|
717
|
717
|
], |
|
718
|
718
|
[ |
|
719
|
|
- ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')', |
|
|
719
|
+ ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')', |
|
720
|
720
|
date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
|
721
|
721
|
date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
|
722
|
722
|
], |
|
@@ -869,7 +869,7 @@ discard block |
|
|
block discarded – undo |
|
869
|
869
|
{ |
|
870
|
870
|
$rows = DB::query( |
|
871
|
871
|
'SELECT date |
|
872
|
|
- FROM ' . prefixTable('log_system') . " |
|
|
872
|
+ FROM ' . prefixTable('log_system')." |
|
873
|
873
|
WHERE field_1 = %s |
|
874
|
874
|
AND type = 'failed_auth' |
|
875
|
875
|
AND label = 'password_is_not_correct' |
|
@@ -883,7 +883,7 @@ discard block |
|
|
block discarded – undo |
|
883
|
883
|
foreach ($rows as $record) { |
|
884
|
884
|
array_push( |
|
885
|
885
|
$arrAttempts, |
|
886
|
|
- date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) |
|
|
886
|
+ date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']) |
|
887
|
887
|
); |
|
888
|
888
|
} |
|
889
|
889
|
} |
|
@@ -937,7 +937,7 @@ discard block |
|
|
block discarded – undo |
|
937
|
937
|
$ldapConnection |
|
938
|
938
|
) : bool |
|
939
|
939
|
{ |
|
940
|
|
- include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
|
940
|
+ include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
941
|
941
|
|
|
942
|
942
|
if ((int) $userInfoDisabled === 1) { |
|
943
|
943
|
return false; |
|
@@ -1129,45 +1129,45 @@ discard block |
|
|
block discarded – undo |
|
1129
|
1129
|
function authenticateThroughAD(string $username, array $userInfo, string $passwordClear, array $SETTINGS): array |
|
1130
|
1130
|
{ |
|
1131
|
1131
|
// Load expected libraries |
|
1132
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
1133
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Support/Arrayable.php'; |
|
1134
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
1135
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
1136
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
1137
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
1138
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
1139
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
1140
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
1141
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
1142
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
1143
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
1144
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
1145
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
1146
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
1147
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
1148
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
1149
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
1150
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
1151
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
1152
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
1153
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
1154
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
1155
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
1156
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
1157
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
1158
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
1159
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
1160
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
1161
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
1162
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
1163
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
1164
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
1165
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
1166
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
1167
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
1168
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
1169
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
1170
|
|
- require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
|
1132
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
|
1133
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Support/Arrayable.php'; |
|
|
1134
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
|
1135
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
|
1136
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
|
1137
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
|
1138
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
|
1139
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
|
1140
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
|
1141
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
|
1142
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
|
1143
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
|
1144
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
|
1145
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
|
1146
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
|
1147
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
|
1148
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
|
1149
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
|
1150
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
|
1151
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
|
1152
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
|
1153
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
|
1154
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
|
1155
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
|
1156
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
|
1157
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
|
1158
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
|
1159
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
|
1160
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
|
1161
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
|
1162
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
|
1163
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
|
1164
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
|
1165
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
|
1166
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
|
1167
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
|
1168
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
|
1169
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
|
1170
|
+ require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
1171
|
1171
|
$ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
|
1172
|
1172
|
$ad->register(); |
|
1173
|
1173
|
|
|
@@ -1204,7 +1204,7 @@ discard block |
|
|
block discarded – undo |
|
1204
|
1204
|
// Get user info from AD |
|
1205
|
1205
|
// We want to isolate attribute ldap_user_attribute |
|
1206
|
1206
|
$userADInfos = $connection->query() |
|
1207
|
|
- ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? strtolower($SETTINGS['ldap_user_attribute']) : 'distinguishedname', '=', $username) |
|
|
1207
|
+ ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? strtolower($SETTINGS['ldap_user_attribute']) : 'distinguishedname', '=', $username) |
|
1208
|
1208
|
->firstOrFail(); |
|
1209
|
1209
|
|
|
1210
|
1210
|
} catch (\LdapRecord\Query\ObjectNotFoundException $e) { |
|
@@ -1266,7 +1266,7 @@ discard block |
|
|
block discarded – undo |
|
1266
|
1266
|
// prepapre background tasks for item keys generation |
|
1267
|
1267
|
$val = DB::queryFirstRow( |
|
1268
|
1268
|
'SELECT valeur |
|
1269
|
|
- FROM ' . prefixTable('misc') . ' |
|
|
1269
|
+ FROM ' . prefixTable('misc').' |
|
1270
|
1270
|
WHERE type = %s AND intitule = %s', |
|
1271
|
1271
|
'secret', |
|
1272
|
1272
|
'pwd' |
|
@@ -1280,8 +1280,8 @@ discard block |
|
|
block discarded – undo |
|
1280
|
1280
|
'process_type' => 'create_user_keys', |
|
1281
|
1281
|
'arguments' => json_encode([ |
|
1282
|
1282
|
'new_user_id' => (int) $userInfo['id'], |
|
1283
|
|
- 'new_user_pwd' => cryption($passwordClear, '','encrypt', $SETTINGS)['string'], |
|
1284
|
|
- 'new_user_code' => cryption(uniqidReal(20), '','encrypt', $SETTINGS)['string'], |
|
|
1283
|
+ 'new_user_pwd' => cryption($passwordClear, '', 'encrypt', $SETTINGS)['string'], |
|
|
1284
|
+ 'new_user_code' => cryption(uniqidReal(20), '', 'encrypt', $SETTINGS)['string'], |
|
1285
|
1285
|
'owner_id' => (int) $_SESSION['user_id'], |
|
1286
|
1286
|
'creator_pwd' => $val['valeur'], |
|
1287
|
1287
|
]), |
|
@@ -1434,12 +1434,12 @@ discard block |
|
|
block discarded – undo |
|
1434
|
1434
|
if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) { |
|
1435
|
1435
|
// Get user groups from AD |
|
1436
|
1436
|
$user_ad_groups = []; |
|
1437
|
|
- foreach($groups as $group) { |
|
|
1437
|
+ foreach ($groups as $group) { |
|
1438
|
1438
|
//print_r($group); |
|
1439
|
1439
|
// get relation role id for AD group |
|
1440
|
1440
|
$role = DB::queryFirstRow( |
|
1441
|
1441
|
'SELECT lgr.role_id |
|
1442
|
|
- FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr |
|
|
1442
|
+ FROM ' . prefixTable('ldap_groups_roles').' AS lgr |
|
1443
|
1443
|
WHERE lgr.ldap_group_id = %i', |
|
1444
|
1444
|
$group |
|
1445
|
1445
|
); |
|
@@ -1489,7 +1489,7 @@ discard block |
|
|
block discarded – undo |
|
1489
|
1489
|
): void |
|
1490
|
1490
|
{ |
|
1491
|
1491
|
// load passwordLib library |
|
1492
|
|
- $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
|
1492
|
+ $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1493
|
1493
|
$pwdlib->register(); |
|
1494
|
1494
|
$pwdlib = new PasswordLib\PasswordLib(); |
|
1495
|
1495
|
$hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
|
@@ -1542,7 +1542,7 @@ discard block |
|
|
block discarded – undo |
|
1542
|
1542
|
function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array |
|
1543
|
1543
|
{ |
|
1544
|
1544
|
// Load superGlobals |
|
1545
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
1545
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1546
|
1546
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
1547
|
1547
|
$sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
|
1548
|
1548
|
$sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
|
@@ -1581,7 +1581,7 @@ discard block |
|
|
block discarded – undo |
|
1581
|
1581
|
} |
|
1582
|
1582
|
|
|
1583
|
1583
|
// Now check yubico validity |
|
1584
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
|
1584
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
1585
|
1585
|
$yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key); |
|
1586
|
1586
|
$auth = $yubi->verify($yubico_key); |
|
1587
|
1587
|
//, null, null, null, 60 |
|
@@ -1622,7 +1622,7 @@ discard block |
|
|
block discarded – undo |
|
1622
|
1622
|
$userKeys = generateUserKeys($passwordClear); |
|
1623
|
1623
|
|
|
1624
|
1624
|
// load passwordLib library |
|
1625
|
|
- $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
|
1625
|
+ $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1626
|
1626
|
$pwdlib->register(); |
|
1627
|
1627
|
$pwdlib = new PasswordLib\PasswordLib(); |
|
1628
|
1628
|
$hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
|
@@ -1680,7 +1680,7 @@ discard block |
|
|
block discarded – undo |
|
1680
|
1680
|
] |
|
1681
|
1681
|
); |
|
1682
|
1682
|
// Rebuild tree |
|
1683
|
|
- $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
|
1683
|
+ $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
1684
|
1684
|
$tree->register(); |
|
1685
|
1685
|
$tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
|
1686
|
1686
|
$tree->rebuild(); |
|
@@ -1712,13 +1712,13 @@ discard block |
|
|
block discarded – undo |
|
1712
|
1712
|
&& empty($dataReceived['GACode']) === false |
|
1713
|
1713
|
) { |
|
1714
|
1714
|
// Load superGlobals |
|
1715
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
1715
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1716
|
1716
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
1717
|
1717
|
$sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
|
1718
|
1718
|
$sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
|
1719
|
1719
|
$sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
|
1720
|
1720
|
// load library |
|
1721
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
|
1721
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
1722
|
1722
|
// create new instance |
|
1723
|
1723
|
$tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']); |
|
1724
|
1724
|
// Init |
|
@@ -1741,7 +1741,7 @@ discard block |
|
|
block discarded – undo |
|
1741
|
1741
|
$mfaMessage = langHdl('ga_flash_qr_and_login'); |
|
1742
|
1742
|
// generate new QR |
|
1743
|
1743
|
$new_2fa_qr = $tfa->getQRCodeImageAsDataUri( |
|
1744
|
|
- 'Teampass - ' . $username, |
|
|
1744
|
+ 'Teampass - '.$username, |
|
1745
|
1745
|
$userInfo['ga'] |
|
1746
|
1746
|
); |
|
1747
|
1747
|
// clear temporary code from DB |
|
@@ -1754,7 +1754,7 @@ discard block |
|
|
block discarded – undo |
|
1754
|
1754
|
$userInfo['id'] |
|
1755
|
1755
|
); |
|
1756
|
1756
|
$firstTime = [ |
|
1757
|
|
- 'value' => '<img src="' . $new_2fa_qr . '">', |
|
|
1757
|
+ 'value' => '<img src="'.$new_2fa_qr.'">', |
|
1758
|
1758
|
'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '', |
|
1759
|
1759
|
'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '', |
|
1760
|
1760
|
'pwd_attempts' => (int) $sessionPwdAttempts, |
|
@@ -1809,12 +1809,12 @@ discard block |
|
|
block discarded – undo |
|
1809
|
1809
|
): array |
|
1810
|
1810
|
{ |
|
1811
|
1811
|
// Load superGlobals |
|
1812
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
1812
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1813
|
1813
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
1814
|
1814
|
|
|
1815
|
1815
|
$sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
|
1816
|
|
- $saved_state = null !== $superGlobal->get('duo_state','SESSION') ? $superGlobal->get('duo_state','SESSION') : ''; |
|
1817
|
|
- $duo_status = null !== $superGlobal->get('duo_status','SESSION') ? $superGlobal->get('duo_status','SESSION') : ''; |
|
|
1816
|
+ $saved_state = null !== $superGlobal->get('duo_state', 'SESSION') ? $superGlobal->get('duo_state', 'SESSION') : ''; |
|
|
1817
|
+ $duo_status = null !== $superGlobal->get('duo_status', 'SESSION') ? $superGlobal->get('duo_status', 'SESSION') : ''; |
|
1818
|
1818
|
|
|
1819
|
1819
|
// Ensure state and login are set |
|
1820
|
1820
|
if ( |
|
@@ -1872,7 +1872,7 @@ discard block |
|
|
block discarded – undo |
|
1872
|
1872
|
): array |
|
1873
|
1873
|
{ |
|
1874
|
1874
|
// Load superGlobals |
|
1875
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
1875
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
1876
|
1876
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
1877
|
1877
|
|
|
1878
|
1878
|
// load libraries |
|
@@ -1918,7 +1918,7 @@ discard block |
|
|
block discarded – undo |
|
1918
|
1918
|
}*/ |
|
1919
|
1919
|
return [ |
|
1920
|
1920
|
'error' => true, |
|
1921
|
|
- 'message' => $duo_error . langHdl('duo_error_check_config'), |
|
|
1921
|
+ 'message' => $duo_error.langHdl('duo_error_check_config'), |
|
1922
|
1922
|
'pwd_attempts' => (int) $sessionPwdAttempts, |
|
1923
|
1923
|
'debug_message' => $e->getMessage(), |
|
1924
|
1924
|
'proceedIdentification' => false, |
|
@@ -1934,7 +1934,7 @@ discard block |
|
|
block discarded – undo |
|
1934
|
1934
|
} catch (Duo\DuoUniversal\DuoException $e) { |
|
1935
|
1935
|
return [ |
|
1936
|
1936
|
'error' => true, |
|
1937
|
|
- 'message' => $duo_error . langHdl('duo_error_url'), |
|
|
1937
|
+ 'message' => $duo_error.langHdl('duo_error_url'), |
|
1938
|
1938
|
'pwd_attempts' => (int) $sessionPwdAttempts, |
|
1939
|
1939
|
'debug_message' => $e->getMessage(), |
|
1940
|
1940
|
'proceedIdentification' => false, |
|
@@ -1942,7 +1942,7 @@ discard block |
|
|
block discarded – undo |
|
1942
|
1942
|
} |
|
1943
|
1943
|
|
|
1944
|
1944
|
// Somethimes Duo return success but fail to return a URL, double check if the URL has been created |
|
1945
|
|
- if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) { |
|
|
1945
|
+ if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) { |
|
1946
|
1946
|
// Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt |
|
1947
|
1947
|
$key = hash('sha256', $duo_state); |
|
1948
|
1948
|
$iv = substr(hash('sha256', $duo_state), 0, 16); |
|
@@ -1968,7 +1968,7 @@ discard block |
|
|
block discarded – undo |
|
1968
|
1968
|
} else { |
|
1969
|
1969
|
return [ |
|
1970
|
1970
|
'error' => true, |
|
1971
|
|
- 'message' => $duo_error . langHdl('duo_error_url'), |
|
|
1971
|
+ 'message' => $duo_error.langHdl('duo_error_url'), |
|
1972
|
1972
|
'pwd_attempts' => (int) $sessionPwdAttempts, |
|
1973
|
1973
|
'proceedIdentification' => false, |
|
1974
|
1974
|
]; |
|
@@ -1989,8 +1989,8 @@ discard block |
|
|
block discarded – undo |
|
1989
|
1989
|
// return the response (which should be the user name) |
|
1990
|
1990
|
if ($decoded_token['preferred_username'] === $username) { |
|
1991
|
1991
|
$superGlobal->put('duo_status', 'COMPLET', 'SESSION'); |
|
1992
|
|
- $superGlobal->forget('duo_state','SESSION'); |
|
1993
|
|
- $superGlobal->forget('duo_data','SESSION'); |
|
|
1992
|
+ $superGlobal->forget('duo_state', 'SESSION'); |
|
|
1993
|
+ $superGlobal->forget('duo_data', 'SESSION'); |
|
1994
|
1994
|
unset($superGlobal); |
|
1995
|
1995
|
|
|
1996
|
1996
|
return [ |
|
@@ -2001,9 +2001,9 @@ discard block |
|
|
block discarded – undo |
|
2001
|
2001
|
]; |
|
2002
|
2002
|
} else { |
|
2003
|
2003
|
// Something wrong, username from the original Duo request is different than the one received now |
|
2004
|
|
- $superGlobal->forget('duo_status','SESSION'); |
|
2005
|
|
- $superGlobal->forget('duo_state','SESSION'); |
|
2006
|
|
- $superGlobal->forget('duo_data','SESSION'); |
|
|
2004
|
+ $superGlobal->forget('duo_status', 'SESSION'); |
|
|
2005
|
+ $superGlobal->forget('duo_state', 'SESSION'); |
|
|
2006
|
+ $superGlobal->forget('duo_data', 'SESSION'); |
|
2007
|
2007
|
unset($superGlobal); |
|
2008
|
2008
|
|
|
2009
|
2009
|
return [ |
|
@@ -2015,9 +2015,9 @@ discard block |
|
|
block discarded – undo |
|
2015
|
2015
|
} |
|
2016
|
2016
|
} |
|
2017
|
2017
|
// If we are here something wrong |
|
2018
|
|
- $superGlobal->forget('duo_status','SESSION'); |
|
2019
|
|
- $superGlobal->forget('duo_state','SESSION'); |
|
2020
|
|
- $superGlobal->forget('duo_data','SESSION'); |
|
|
2018
|
+ $superGlobal->forget('duo_status', 'SESSION'); |
|
|
2019
|
+ $superGlobal->forget('duo_state', 'SESSION'); |
|
|
2020
|
+ $superGlobal->forget('duo_data', 'SESSION'); |
|
2021
|
2021
|
unset($superGlobal); |
|
2022
|
2022
|
return [ |
|
2023
|
2023
|
'error' => true, |
|
@@ -2043,8 +2043,8 @@ discard block |
|
|
block discarded – undo |
|
2043
|
2043
|
// Set to false |
|
2044
|
2044
|
$userPasswordVerified = false; |
|
2045
|
2045
|
// load passwordLib library |
|
2046
|
|
- include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
2047
|
|
- $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
|
2046
|
+ include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
|
2047
|
+ $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
2048
|
2048
|
$pwdlib->register(); |
|
2049
|
2049
|
$pwdlib = new PasswordLib\PasswordLib(); |
|
2050
|
2050
|
// Check if old encryption used |
|
@@ -2177,8 +2177,8 @@ discard block |
|
|
block discarded – undo |
|
2177
|
2177
|
public function get_user_info($login, $enable_ad_user_auto_creation) { |
|
2178
|
2178
|
$data = DB::queryFirstRow( |
|
2179
|
2179
|
'SELECT u.*, a.value AS api_key |
|
2180
|
|
- FROM ' . prefixTable('users') . ' AS u |
|
2181
|
|
- LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id) |
|
|
2180
|
+ FROM ' . prefixTable('users').' AS u |
|
|
2181
|
+ LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id) |
|
2182
|
2182
|
WHERE login = %s', |
|
2183
|
2183
|
$login |
|
2184
|
2184
|
); |
|
@@ -2198,7 +2198,7 @@ discard block |
|
|
block discarded – undo |
|
2198
|
2198
|
}*/ |
|
2199
|
2199
|
|
|
2200
|
2200
|
// Prepare user roles (fonction_id + roles_from_ad_groups) |
|
2201
|
|
- $data['fonction_id'] = is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']); |
|
|
2201
|
+ $data['fonction_id'] = is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']); |
|
2202
|
2202
|
|
|
2203
|
2203
|
return $data; |
|
2204
|
2204
|
} |
|
@@ -2277,7 +2277,7 @@ discard block |
|
|
block discarded – undo |
|
2277
|
2277
|
$checks->get_is_too_much_attempts($sessionPwdAttempts); |
|
2278
|
2278
|
} catch (Exception $e) { |
|
2279
|
2279
|
// Load superGlobals |
|
2280
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
2280
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2281
|
2281
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
2282
|
2282
|
$superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION'); |
|
2283
|
2283
|
$superGlobal->put('pwd_attempts', 0, 'SESSION'); |
|
@@ -2523,19 +2523,19 @@ discard block |
|
|
block discarded – undo |
|
2523
|
2523
|
if ($ret['error'] !== false) { |
|
2524
|
2524
|
logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username)); |
|
2525
|
2525
|
// Load superGlobals |
|
2526
|
|
- include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
|
2526
|
+ include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
2527
|
2527
|
# Retrieve the previously stored state and username from the session |
|
2528
|
2528
|
$superGlobal = new protect\SuperGlobal\SuperGlobal(); |
|
2529
|
|
- $superGlobal->forget('duo_state','SESSION'); |
|
2530
|
|
- $superGlobal->forget('duo_data','SESSION'); |
|
2531
|
|
- $superGlobal->forget('duo_status','SESSION'); |
|
|
2529
|
+ $superGlobal->forget('duo_state', 'SESSION'); |
|
|
2530
|
+ $superGlobal->forget('duo_data', 'SESSION'); |
|
|
2531
|
+ $superGlobal->forget('duo_status', 'SESSION'); |
|
2532
|
2532
|
unset($superGlobal); |
|
2533
|
2533
|
return [ |
|
2534
|
2534
|
'error' => true, |
|
2535
|
2535
|
'mfaData' => $ret, |
|
2536
|
2536
|
'mfaQRCodeInfos' => false, |
|
2537
|
2537
|
]; |
|
2538
|
|
- } else if ($ret['duo_url_ready'] === true){ |
|
|
2538
|
+ } else if ($ret['duo_url_ready'] === true) { |
|
2539
|
2539
|
return [ |
|
2540
|
2540
|
'error' => false, |
|
2541
|
2541
|
'mfaData' => $ret, |