|
24 | 24 | use ElkArte\Helper\Util;
|
25 | 25 | use ElkArte\Http\Headers;
|
26 | 26 | use ElkArte\Languages\Txt;
|
| 27 | +use ElkArte\Request; |
27 | 28 | use ElkArte\User;
|
28 | 29 | use ElkArte\UserSettingsLoader;
|
29 | 30 |
|
@@ -143,7 +144,7 @@ public function action_login2()
|
143 | 144 | }
|
144 | 145 |
|
145 | 146 | // Are you guessing with a script?
|
146 |
| - checkSession('post'); |
| 147 | + checkSession(); |
147 | 148 | validateToken('login');
|
148 | 149 | spamProtection('login');
|
149 | 150 |
|
@@ -234,7 +235,7 @@ public function action_login2()
|
234 | 235 | $member_found = loadExistingMember($_POST['user']);
|
235 | 236 | $db = database();
|
236 | 237 | $cache = Cache::instance();
|
237 |
| - $req = request(); |
| 238 | + $req = Request::instance(); |
238 | 239 |
|
239 | 240 | $user = new UserSettingsLoader($db, $cache, $req);
|
240 | 241 | $user->loadUserById($member_found === false ? 0 : $member_found['id_member'], true, '');
|
@@ -377,10 +378,15 @@ private function _other_passwords($posted_password, $member_name, $passwrd, $pas
|
377 | 378 | $pw_strlen = strlen($passwrd);
|
378 | 379 |
|
379 | 380 | // Start off with none, that's safe
|
380 |
| - $other_passwords = array(); |
| 381 | + $other_passwords = []; |
| 382 | + |
| 383 | + if (empty($modSettings['enable_password_conversion'])) |
| 384 | + { |
| 385 | + return $other_passwords; |
| 386 | + } |
381 | 387 |
|
382 | 388 | // None of the below cases will be used most of the time (because the salt is normally set.)
|
383 |
| - if (!empty($modSettings['enable_password_conversion']) && $password_salt === '') |
| 389 | + if ($password_salt === '') |
384 | 390 | {
|
385 | 391 | // YaBB SE, Discus, MD5 (used a lot), SHA-1 (used some), SMF 1.0.x, IkonBoard, and none at all.
|
386 | 392 | $other_passwords[] = crypt($posted_password, substr($posted_password, 0, 2));
|
@@ -415,7 +421,7 @@ private function _other_passwords($posted_password, $member_name, $passwrd, $pas
|
415 | 421 | $other_passwords[] = crypt($posted_password, $passwrd);
|
416 | 422 | }
|
417 | 423 | // The hash should be 40 if it's SHA-1, so we're safe with more here too.
|
418 |
| - elseif (!empty($modSettings['enable_password_conversion']) && $pw_strlen === 32) |
| 424 | + elseif ($pw_strlen === 32) |
419 | 425 | {
|
420 | 426 | // vBulletin 3 style hashing? Let's welcome them with open arms \o/.
|
421 | 427 | $other_passwords[] = md5(md5($posted_password) . stripslashes($password_salt));
|
@@ -460,7 +466,7 @@ private function _other_passwords($posted_password, $member_name, $passwrd, $pas
|
460 | 466 | }
|
461 | 467 | }
|
462 | 468 | // SHA-256 will be 64 characters long, lets check some of these possibilities
|
463 |
| - elseif (!empty($modSettings['enable_password_conversion']) && $pw_strlen === 64) |
| 469 | + elseif ($pw_strlen === 64) |
464 | 470 | {
|
465 | 471 | // PHP-Fusion7
|
466 | 472 | $other_passwords[] = hash_hmac('sha256', $posted_password, $password_salt);
|
@@ -782,7 +788,7 @@ function doLogin(UserSettingsLoader $user)
|
782 | 788 | }
|
783 | 789 |
|
784 | 790 | // You're one of us: need to know all about you now, IP, stuff.
|
785 |
| - $req = request(); |
| 791 | + $req = Request::instance(); |
786 | 792 |
|
787 | 793 | // You've logged in, haven't you?
|
788 | 794 | require_once(SUBSDIR . '/Members.subs.php');
|
|
0 commit comments