X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=application%2Fcontrollers%2FUserController.php;h=f802b16b66d85eba8c80dd595eebf8d71a4dd60d;hb=ce001229accb2aff799560eec402344f0dbb1762;hp=ed078ad9688f2442965301f61e06964249735daa;hpb=05ce9238adfa982746bfc6211b240fd24526af09;p=syj.git diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php index ed078ad..f802b16 100644 --- a/application/controllers/UserController.php +++ b/application/controllers/UserController.php @@ -5,6 +5,21 @@ class UserController extends Zend_Controller_Action { + public function existsAction() { + $name = $this->getRequest()->getUserParam('name'); + + $userMapper = new Syj_Model_UserMapper(); + $user = new Syj_Model_User(); + + if ($userMapper->findByPseudo($name, $user)) { + $this->_helper->SyjApi->setCode(200); + } else { + // opera needs some body content with 404 code, otherwise, it + // reports a xmlhttprequest.status of 0 + $this->_helper->SyjApi->setCode(404)->setBody(' '); + } + } + public function userAction() { $formData = $this->_helper->SyjPostData->getPostData('Syj_Form_User'); @@ -19,7 +34,6 @@ class UserController extends Zend_Controller_Action $user->pseudo = $formData["user_pseudo"]; $user->password = sha1($formData["user_password"]); $user->email = $formData["user_email"]; - $user->creationAddr = $this->getRequest()->getClientIp(true); if (Zend_Registry::isRegistered('Zend_Translate')) { $translator = Zend_Registry::get('Zend_Translate');