[Isocial-svn] SF.net SVN: isocial: [26] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-02-25 18:11:06
|
Revision: 26 http://isocial.svn.sourceforge.net/isocial/?rev=26&view=rev Author: dim0s77 Date: 2008-02-25 10:10:24 -0800 (Mon, 25 Feb 2008) Log Message: ----------- minor fixes in login Modified Paths: -------------- app/controllers/user_controller.php app/models/user.php Modified: app/controllers/user_controller.php =================================================================== --- app/controllers/user_controller.php 2008-02-25 17:58:01 UTC (rev 25) +++ app/controllers/user_controller.php 2008-02-25 18:10:24 UTC (rev 26) @@ -38,11 +38,7 @@ return; } - $user = $this->User->login($this->params['email'], $this->params['password']); - if ($user) { - $this->_login($user->id); - $this->redirectToAction( 'home' ); - } + $this->_loginUser($this->params['email'], $this->params['password']); $this->addError( '_common', @@ -51,6 +47,15 @@ ); } + function _loginUser ($email, $password) + { + $user = $this->User->login($email, $password); + if ($user && $user->active) { + $this->_login($user->id); + $this->redirectToAction( 'home' ); + } + } + function logout () { $this->_logout(); $this->redirectToAction( 'login' ); @@ -122,14 +127,14 @@ $confirmation = $this->Confirmation->findFirst(array('uuid' => $this->params['uuid'])); if ($confirmation) { $user = $this->User->findFirst(array( 'id' => $confirmation->user_id )); - if ($user && $user->active == 1) { + if ($user) { if ($user->email == $this->params['email']) { if (!empty($this->params['user'])){ - $user->setAttributes($this->params['user']); + $user_data = $this->params['user']; + $user->setAttributes($user_data); if ($user->updatePassword()) { $confirmation->destroy(); - $this->_login($user->id); - $this->redirectToAction( 'home' ); + $this->_loginUser($this->params['email'], $user_data['password']); } } else { $this->email = $user->email; Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-02-25 17:58:01 UTC (rev 25) +++ app/models/user.php 2008-02-25 18:10:24 UTC (rev 26) @@ -10,6 +10,7 @@ $this->validatePasswords(); if (!count($this->getErrors())) { $this->_encryptPassword(); + $this->active = 1; return $this->save(); } return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |