| @@ 77-85 (lines=9) @@ | ||
| 74 | $userIsReallyOnline = user_is_online($userId); |
|
| 75 | ||
| 76 | // Trying double login. |
|
| 77 | if (!empty($loginData) && $userIsReallyOnline == true) { |
|
| 78 | session_regenerate_id(); |
|
| 79 | Session::destroy(); |
|
| 80 | header('Location: '.api_get_path(WEB_PATH).'index.php?loginFailed=1&error=multiple_connection_not_allowed'); |
|
| 81 | exit; |
|
| 82 | } else { |
|
| 83 | // First time |
|
| 84 | Session::write('first_user_login', 1); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | } |
|
| 88 | } |
|
| @@ 687-699 (lines=13) @@ | ||
| 684 | ); |
|
| 685 | } |
|
| 686 | } |
|
| 687 | if ($matches_domain) { |
|
| 688 | //make all the process of checking |
|
| 689 | //if the user exists (delegated to the sso class) |
|
| 690 | $osso->check_user(); |
|
| 691 | } else { |
|
| 692 | error_log('Check the sso_referer URL in your script, it doesn\'t match any of the possibilities'); |
|
| 693 | //Request comes from unknown source |
|
| 694 | $loginFailed = true; |
|
| 695 | Session::erase('_uid'); |
|
| 696 | Session::write('loginFailed', '1'); |
|
| 697 | header('Location: '.api_get_path(WEB_PATH).'index.php?loginFailed=1&error=unrecognize_sso_origin'); |
|
| 698 | exit; |
|
| 699 | } |
|
| 700 | } |
|
| 701 | //end logout ... else ... login |
|
| 702 | } elseif ($logout) { |
|
| @@ 308-315 (lines=8) @@ | ||
| 305 | } |
|
| 306 | ||
| 307 | // Redirect to login page |
|
| 308 | if ($captchaValidated == false) { |
|
| 309 | $loginFailed = true; |
|
| 310 | Session::erase('_uid'); |
|
| 311 | Session::write('loginFailed', '1'); |
|
| 312 | ||
| 313 | header('Location: '.api_get_path(WEB_PATH).'index.php?loginFailed=1&error=wrong_captcha'); |
|
| 314 | exit; |
|
| 315 | } |
|
| 316 | ||
| 317 | // Check if account is blocked by captcha user extra field see function api_block_account_captcha() |
|
| 318 | $blockedUntilDate = api_get_user_blocked_by_captcha($login); |
|
| @@ 324-331 (lines=8) @@ | ||
| 321 | if (time() > api_strtotime($blockedUntilDate, 'UTC')) { |
|
| 322 | api_clean_account_captcha($login); |
|
| 323 | ||
| 324 | } else { |
|
| 325 | $loginFailed = true; |
|
| 326 | Session::erase('_uid'); |
|
| 327 | Session::write('loginFailed', '1'); |
|
| 328 | ||
| 329 | header('Location: '.api_get_path(WEB_PATH).'index.php?loginFailed=1&error=blocked_by_captcha'); |
|
| 330 | exit; |
|
| 331 | } |
|
| 332 | } |
|
| 333 | } |
|
| 334 | ||
| @@ 426-435 (lines=10) @@ | ||
| 423 | Session::write('_user', $_user); |
|
| 424 | Event::event_login($_user['user_id']); |
|
| 425 | $logging_in = true; |
|
| 426 | } else { |
|
| 427 | $loginFailed = true; |
|
| 428 | Session::erase('_uid'); |
|
| 429 | Session::write('loginFailed', '1'); |
|
| 430 | header( |
|
| 431 | 'Location: '.api_get_path(WEB_PATH) |
|
| 432 | .'index.php?loginFailed=1&error=access_url_inactive' |
|
| 433 | ); |
|
| 434 | exit; |
|
| 435 | } |
|
| 436 | } |
|
| 437 | } |
|
| 438 | } else { |
|
| @@ 448-457 (lines=10) @@ | ||
| 445 | $logging_in = true; |
|
| 446 | ||
| 447 | } |
|
| 448 | } else { |
|
| 449 | $loginFailed = true; |
|
| 450 | Session::erase('_uid'); |
|
| 451 | Session::write('loginFailed', '1'); |
|
| 452 | header( |
|
| 453 | 'Location: '.api_get_path(WEB_PATH) |
|
| 454 | .'index.php?loginFailed=1&error=account_expired' |
|
| 455 | ); |
|
| 456 | exit; |
|
| 457 | } |
|
| 458 | } else { |
|
| 459 | $loginFailed = true; |
|
| 460 | Session::erase('_uid'); |
|
| @@ 458-467 (lines=10) @@ | ||
| 455 | ); |
|
| 456 | exit; |
|
| 457 | } |
|
| 458 | } else { |
|
| 459 | $loginFailed = true; |
|
| 460 | Session::erase('_uid'); |
|
| 461 | Session::write('loginFailed', '1'); |
|
| 462 | header( |
|
| 463 | 'Location: '.api_get_path(WEB_PATH) |
|
| 464 | .'index.php?loginFailed=1&error=account_inactive' |
|
| 465 | ); |
|
| 466 | exit; |
|
| 467 | } |
|
| 468 | } else { |
|
| 469 | // login failed: username or password incorrect |
|
| 470 | $loginFailed = true; |
|