Changeset 7c8fd80 in github
- Timestamp:
- Jun 30, 2012 12:41:18 PM (11 months ago)
- Children:
- b1f30d8
- Parents:
- f69eb5f
- Files:
-
- 4 edited
-
CHANGELOG (modified) (1 diff)
-
index.php (modified) (2 diffs)
-
program/include/rcmail.php (modified) (4 diffs)
-
program/localization/en_US/messages.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
rad9dac5 r7c8fd80 2 2 =========================== 3 3 4 - Show explicit error message when provided hostname is invalid (#1488550) 4 5 - Fix wrong compose screen elements focus in IE9 (#1488541) 5 6 - Fix fatal error when date.timezone isn't set (#1488546) -
index.php
r041c93c r7c8fd80 101 101 )); 102 102 103 // check if client supports cookies 104 if ($auth['cookiecheck'] && empty($_COOKIE)) { 105 $OUTPUT->show_message("cookiesdisabled", 'warning'); 106 } 107 else if ($auth['valid'] && !$auth['abort'] && 108 $RCMAIL->login($auth['user'], $auth['pass'], $auth['host']) 103 // Login 104 if ($auth['valid'] && !$auth['abort'] && 105 $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'], $auth['cookiecheck']) 109 106 ) { 110 107 // create new session ID, don't destroy the current session … … 141 138 } 142 139 else { 143 $error_code = is_object($RCMAIL->storage) ? $RCMAIL->storage->get_error_code() : 1; 144 145 $OUTPUT->show_message($error_code < -1 ? 'storageerror' : (!$auth['valid'] ? 'invalidrequest' : 'loginfailed'), 'warning'); 140 if (!$auth['valid']) { 141 $error_code = RCMAIL::ERROR_INVALID_REQUEST; 142 } 143 else { 144 $error_code = $auth['error'] ? $auth['error'] : $RCMAIL->login_error(); 145 } 146 147 $error_labels = array( 148 RCMAIL::ERROR_STORAGE => 'storageerror', 149 RCMAIL::ERROR_COOKIES_DISABLED => 'cookiesdisabled', 150 RCMAIL::ERROR_INVALID_REQUEST => 'invalidrequest', 151 RCMAIL::ERROR_INVALID_HOST => 'invalidhost', 152 ); 153 154 $error_message = $error_labels[$error_code] ? $error_labels[$error_code] : 'loginfailed'; 155 156 $OUTPUT->show_message($error_message, 'warning'); 146 157 $RCMAIL->plugins->exec_hook('login_failed', array( 147 158 'code' => $error_code, 'host' => $auth['host'], 'user' => $auth['user'])); -
program/include/rcmail.php
r8749e94 r7c8fd80 59 59 const JS_OBJECT_NAME = 'rcmail'; 60 60 61 const ERROR_STORAGE = -2; 62 const ERROR_INVALID_REQUEST = 1; 63 const ERROR_INVALID_HOST = 2; 64 const ERROR_COOKIES_DISABLED = 3; 65 66 61 67 /** 62 68 * This implements the 'singleton' design pattern … … 367 373 * @param string Mail storage (IMAP) password 368 374 * @param string Mail storage (IMAP) host 375 * @param bool Enables cookie check 369 376 * 370 377 * @return boolean True on success, False on failure 371 378 */ 372 function login($username, $pass, $host =NULL)379 function login($username, $pass, $host = null, $cookiecheck = false) 373 380 { 381 $this->login_error = null; 382 374 383 if (empty($username)) { 384 return false; 385 } 386 387 if ($cookiecheck && empty($_COOKIE)) { 388 $this->login_error = self::ERROR_COOKIES_DISABLED; 375 389 return false; 376 390 } … … 392 406 } 393 407 } 394 if (!$allowed) 395 return false;408 if (!$allowed) { 409 $host = null; 396 410 } 397 else if (!empty($config['default_host']) && $host != rcube_utils::parse_host($config['default_host'])) 411 } 412 else if (!empty($config['default_host']) && $host != rcube_utils::parse_host($config['default_host'])) { 413 $host = null; 414 } 415 416 if (!$host) { 417 $this->login_error = self::ERROR_INVALID_HOST; 398 418 return false; 419 } 399 420 400 421 // parse $host URL … … 533 554 return false; 534 555 } 556 557 558 /** 559 * Returns error code of last login operation 560 * 561 * @return int Error code 562 */ 563 public function login_error() 564 { 565 if ($this->login_error) { 566 return $this->login_error; 567 } 568 569 if ($this->storage && $this->storage->get_error_code() < -1) { 570 return self::ERROR_STORAGE; 571 } 572 } 535 573 536 574 -
program/localization/en_US/messages.inc
rca1c2a8 r7c8fd80 34 34 $messages['errornoperm'] = 'Unable to perform operation. Permission denied.'; 35 35 $messages['invalidrequest'] = 'Invalid request! No data was saved.'; 36 $messages['invalidhost'] = 'Invalid server name.'; 36 37 $messages['nomessagesfound'] = 'No messages found in this mailbox.'; 37 38 $messages['loggedout'] = 'You have successfully terminated the session. Good bye!';
Note: See TracChangeset
for help on using the changeset viewer.
