"Removing checks in Component::init(); to check for Security component.

Changed AuthComponent::startup() so that the password key $this->data is set to null when login fails instead of being unset."

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6589 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-03-17 02:31:55 +00:00
parent ecfd70052d
commit f6652d1b73
2 changed files with 4 additions and 9 deletions

View file

@ -54,12 +54,7 @@ class Component extends Object {
$this->controller =& $controller; $this->controller =& $controller;
if ($this->controller->components !== false) { if ($this->controller->components !== false) {
$loaded = array(); $loaded = array();
if (!in_array('Session', $this->controller->components)) {
if(in_array('Security', $this->controller->components)) {
$remove = array_flip($this->controller->components);
unset($remove['Security']);
$this->controller->components = array_merge(array('Session', 'Security'), array_flip($remove));
} else {
$this->controller->components = array_merge(array('Session'), $this->controller->components); $this->controller->components = array_merge(array('Session'), $this->controller->components);
} }
$loaded = $this->_loadComponents($loaded, $this->controller->components); $loaded = $this->_loadComponents($loaded, $this->controller->components);

View file

@ -279,11 +279,11 @@ class AuthComponent extends Object {
} }
$this->loginAction = Router::normalize($this->loginAction); $this->loginAction = Router::normalize($this->loginAction);
if ($this->loginAction != Router::normalize($url) && ($this->allowedActions == array('*') || in_array($controller->action, $this->allowedActions))) { if ($this->loginAction != Router::normalize($url) && ($this->allowedActions == array('*') || in_array($controller->action, $this->allowedActions))) {
return false; return false;
} }
if ($this->loginAction == Router::normalize($url)) { if ($this->loginAction == Router::normalize($url)) {
if (empty($controller->data) || !isset($controller->data[$this->userModel])) { if (empty($controller->data) || !isset($controller->data[$this->userModel])) {
if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) { if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
@ -304,7 +304,7 @@ class AuthComponent extends Object {
return true; return true;
} else { } else {
$this->Session->setFlash($this->loginError, 'default', array(), 'auth'); $this->Session->setFlash($this->loginError, 'default', array(), 'auth');
unset($controller->data[$this->userModel][$this->fields['password']]); $controller->data[$this->userModel][$this->fields['password']] = null;
} }
return false; return false;
} else { } else {