Example #1
0
 /**
  * @return string
  */
 public function handleLoginFailed()
 {
     $message = get_lang('InvalidId');
     if (!isset($_GET['error'])) {
         if (api_is_self_registration_allowed()) {
             $message = get_lang('InvalidForSelfRegistration');
         }
     } else {
         switch ($_GET['error']) {
             case '':
                 if (api_is_self_registration_allowed()) {
                     $message = get_lang('InvalidForSelfRegistration');
                 }
                 break;
             case 'account_expired':
                 $message = get_lang('AccountExpired');
                 break;
             case 'account_inactive':
                 $message = get_lang('AccountInactive');
                 break;
             case 'user_password_incorrect':
                 $message = get_lang('InvalidId');
                 break;
             case 'access_url_inactive':
                 $message = get_lang('AccountURLInactive');
                 break;
             case 'wrong_captcha':
                 $message = get_lang('TheTextYouEnteredDoesNotMatchThePicture');
                 break;
             case 'blocked_by_captcha':
                 $message = get_lang('AccountBlockedByCaptcha');
                 break;
             case 'multiple_connection_not_allowed':
                 $message = get_lang('MultipleConnectionsAreNotAllow');
                 break;
             case 'unrecognize_sso_origin':
                 //$message = get_lang('SSOError');
                 break;
         }
     }
     return Display::return_message($message, 'error');
 }
 /**
  * Reacts on a failed login.
  * Displays an explanation with a link to the registration form.
  *
  * @todo use twig template to prompt errors + move this into a helper
  */
 private function handleLoginFailed($error)
 {
     $message = get_lang('InvalidId');
     if (!isset($error)) {
         if (api_is_self_registration_allowed()) {
             $message = get_lang('InvalidForSelfRegistration');
         }
     } else {
         switch ($error) {
             case '':
                 if (api_is_self_registration_allowed()) {
                     $message = get_lang('InvalidForSelfRegistration');
                 }
                 break;
             case 'account_expired':
                 $message = get_lang('AccountExpired');
                 break;
             case 'account_inactive':
                 $message = get_lang('AccountInactive');
                 break;
             case 'user_password_incorrect':
                 $message = get_lang('InvalidId');
                 break;
             case 'access_url_inactive':
                 $message = get_lang('AccountURLInactive');
                 break;
             case 'unrecognize_sso_origin':
                 //$message = get_lang('SSOError');
                 break;
         }
     }
     return \Display::return_message($message, 'error');
 }