當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Users::getMessages方法代碼示例

本文整理匯總了PHP中Users::getMessages方法的典型用法代碼示例。如果您正苦於以下問題:PHP Users::getMessages方法的具體用法?PHP Users::getMessages怎麽用?PHP Users::getMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Users的用法示例。


在下文中一共展示了Users::getMessages方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: loginFbAction

 public function loginFbAction()
 {
     $response = new ApiResponse();
     if ($this->request->isPost()) {
         $fbId = $this->request->getPost('fbId');
         $username = $this->request->getPost('username');
         $email = $this->request->getPost('email');
         $avatar = $this->request->getPost('avatar');
         $user = Users::findFirstByFbId($fbId);
         if ($user == true) {
             $response->setResponseMessage('Login successfully!');
             return $response;
         } else {
             $user = new Users();
             $user->id = uniqid();
             $user->fbId = $fbId;
             $user->avatar = $avatar;
             $user->username = $username;
             $user->email = $email;
             try {
                 if ($user->save() == false) {
                     $response->setResponseError(implode(', ', $user->getMessages()));
                 } else {
                     $response->setResponseMessage('Register successfully!');
                 }
             } catch (PDOException $e) {
                 $response->setResponseError($e->getMessage());
             }
         }
     } else {
         $response->setResponseError('Wrong HTTP Method');
     }
     return $response;
 }
開發者ID:nvg58,項目名稱:uethackathon2015_team08server,代碼行數:34,代碼來源:UserController.php

示例2: indexAction

 /**
  * Action to register a new user
  */
 public function indexAction()
 {
     $form = new RegisterForm();
     if ($this->request->isPost()) {
         $name = $this->request->getPost('name', array('string', 'striptags'));
         $username = $this->request->getPost('username', 'alphanum');
         $email = $this->request->getPost('email', 'email');
         $password = $this->request->getPost('password');
         $repeatPassword = $this->request->getPost('repeatPassword');
         if ($password != $repeatPassword) {
             $this->flash->error('Passwords are diferent');
             return false;
         }
         $user = new Users();
         $user->username = $username;
         $user->password = sha1($password);
         $user->name = $name;
         $user->email = $email;
         $user->created_at = new Phalcon\Db\RawValue('now()');
         $user->active = 'Y';
         if ($user->save() == false) {
             foreach ($user->getMessages() as $message) {
                 $this->flash->error((string) $message);
             }
         } else {
             $this->tag->setDefault('email', '');
             $this->tag->setDefault('password', '');
             $this->flash->success('Thanks for sign-up, please log-in to start generating invoices');
             return $this->forward('session/index');
         }
     }
     $this->view->form = $form;
 }
開發者ID:Kefir92,項目名稱:home-bookkeeping,代碼行數:36,代碼來源:RegisterController.php

示例3: registerAction

 public function registerAction()
 {
     if ($this->request->isPost()) {
         $name = $this->request->getPost('name', 'string');
         $username = $this->request->getPost('username', 'string');
         $email = $this->request->getPost('email', 'email');
         $password = $this->request->getPost('password');
         $repeatPassword = $this->request->getPost('repeatPassword');
         if ($password != $repeatPassword) {
             Flash::error((string) $message, 'alert alert-error');
             return false;
         }
         $name = strip_tags($name);
         $username = strip_tags($username);
         $user = new Users();
         $user->username = $username;
         $user->password = sha1($password);
         $user->name = $name;
         $user->email = $email;
         $user->created_at = new Phalcon_Db_RawValue('now()');
         $user->active = 'Y';
         if ($user->save() == false) {
             foreach ($user->getMessages() as $message) {
                 Flash::error((string) $message, 'alert alert-error');
             }
         } else {
             Tag::setDefault('email', '');
             Tag::setDefault('password', '');
             Flash::success('Thanks for sign-up, please log-in to start generating invoices', 'alert alert-success');
             return $this->_forward('session/index');
         }
     }
 }
開發者ID:racklin,項目名稱:invo,代碼行數:33,代碼來源:SessionController.php

示例4: indexAction

 public function indexAction()
 {
     if ($this->request->isPost()) {
         $username = $this->request->getPost('username', 'alphanum');
         $email = $this->request->getPost('email', 'email');
         $password = $this->request->getPost('password');
         $name = $this->request->getPost('name');
         $phone = $this->request->getPost('phone');
         $user = new Users();
         $user->username = $username;
         $user->email = $email;
         $user->password = sha1($password);
         $user->name = $name;
         $user->created_at = new Phalcon\Db\RawValue('now()');
         $user->active = 'Y';
         $user->class = '1';
         $user->phone = $phone;
         if ($user->save() == false) {
             foreach ($user->getMessages() as $message) {
                 $this->flash->error((string) $message);
             }
         } else {
             $this->tag->setDefault('email', '');
             $this->tag->setDefault('password', '');
             $this->flash->success('Спасибо за регистрацию, пожалуйста войдите в вашу учетную запись');
             return $this->view->pick("login/index");
         }
     }
 }
開發者ID:Altairko,項目名稱:REA,代碼行數:29,代碼來源:SignupController.php

示例5: indexAction

 /**
  * Action to register a new user
  */
 public function indexAction()
 {
     $form = new RegisterForm();
     if ($this->request->isPost()) {
         $name = $this->request->getPost('name', array('string', 'striptags'));
         $username = $this->request->getPost('username', 'alphanum');
         $email = $this->request->getPost('email', 'email');
         $password = $this->request->getPost('password');
         $repeatPassword = $this->request->getPost('repeatPassword');
         if ($password != $repeatPassword) {
             $this->flash->error('Passwords are different');
             return false;
         }
         $user = new Users();
         $user->username = $username;
         $user->password = sha1($password);
         $user->name = $name;
         $user->email = $email;
         $user->created_at = new Phalcon\Db\RawValue('now()');
         $user->active = 'Y';
         $user->key = md5($email);
         if ($user->save() == false) {
             foreach ($user->getMessages() as $message) {
                 $this->flash->error((string) $message);
             }
         } else {
             $this->tag->setDefault('email', '');
             $this->tag->setDefault('password', '');
             $this->flash->success('Спасибо за регисрация. Пожалуйста залогинтесь для использования API');
             return $this->forward('session/index');
         }
     }
     $this->view->form = $form;
 }
開發者ID:groumand,項目名稱:restAPI-php-phalcon,代碼行數:37,代碼來源:RegisterController.php

示例6: addAction

 /**
  * Create new user
  */
 public function addAction()
 {
     // check API authentication
     if (!$this->authenticateRequest()) {
         return $this->processResponse(array('status' => 401, 'payload' => array('status' => 'failure', 'data' => null, 'error' => array('code' => 401, 'message' => 'API authentication failed'))));
     }
     // verify token
     if (!$this->verifyCsrfToken()) {
         return $this->processResponse(array('status' => 401, 'payload' => array('status' => 'failure', 'data' => null, 'error' => array('code' => 401, 'message' => 'Token validation failed'))));
     }
     // get HTTP entity body
     $httpContent = file_get_contents('php://input');
     if (empty($httpContent)) {
         return $this->processResponse(array('status' => 404, 'payload' => array('status' => 'failure', 'data' => null, 'error' => array('code' => 404, 'message' => 'User information not provided'))));
     }
     $data = json_decode($httpContent);
     // create user
     $user = new Users();
     $user->name = htmlentities($data->name);
     $user->createdDate = new MongoDate();
     $user->modifiedDate = new MongoDate();
     if ($user->save() == false) {
         foreach ($user->getMessages() as $message) {
             $this->logger->log(sprintf('NAMESPACE=user MESSAGE=%s', $message), \Phalcon\Logger::ERROR);
         }
         return $this->processResponse(array('status' => 404, 'payload' => array('status' => 'failure', 'data' => null, 'error' => array('code' => 404, 'message' => 'Failed to create user'))));
     } else {
         return $this->processResponse(array('status' => 201, 'payload' => array('status' => 'success', 'data' => json_encode($user), 'error' => null)));
     }
 }
開發者ID:enajeeb,項目名稱:phalcon-rest-boilerplate,代碼行數:33,代碼來源:UserController.php

示例7: upAction

 /**
  * Registration
  */
 public function upAction()
 {
     if ($this->request->isPost()) {
         $user = new Users();
         $user->login = $this->request->getPost('login', 'string');
         $user->password = $this->request->getPost('password', 'string');
         $passwordVerify = $this->request->getPost('password-verify', 'string');
         if (md5($user->password) !== md5($passwordVerify)) {
             $this->flashSession->error('Пароли не совпадают');
             return;
         }
         if (!$user->create()) {
             $this->flashSession->error(implode("<br/>", $user->getMessages()));
             return;
         }
         $auth = new Auth();
         $authSucceed = $auth->authorize($user);
         if ($authSucceed) {
             $this->response->redirect();
             return;
         }
         $this->dispatcher->forward(['controller' => 'sign', 'action' => 'in']);
         return;
     }
 }
開發者ID:vlad6085,項目名稱:projectstorage,代碼行數:28,代碼來源:SignController.php

示例8: signupAction

 public function signupAction()
 {
     if ($this->request->isPost()) {
         if ($this->request->getPost()) {
             $user = new Users();
             $user->assign(array('username' => $this->request->getPost('username', 'striptags'), 'email' => $this->request->getPost('email'), 'password' => $this->security->hash($this->request->getPost('password')), 'fullName' => $this->request->getPost('fullName')));
             if ($user->save()) {
                 return $this->dispatcher->forward(array('controller' => 'session', 'action' => 'index'));
             }
             $this->flash->error($user->getMessages());
         }
     }
 }
開發者ID:carlosstenzel,項目名稱:sendmail,代碼行數:13,代碼來源:SessionController.php

示例9: registerAction

 public function registerAction()
 {
     $user = new Users();
     //Store and check for errors
     if ($user->save($_POST, array('name', 'email')) == true) {
         echo "Thanks for register!";
     } else {
         echo "Sorry, the following problems were generated: ";
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
 }
開發者ID:aodkrisda,項目名稱:phalcon-code,代碼行數:13,代碼來源:tutorial-427.php

示例10: registerAction

 public function registerAction()
 {
     $user = new Users();
     //Store and check for errors
     $success = $user->save($this->request->getPost(), array('name', 'email'));
     if ($success) {
         echo "Thanks for register!";
     } else {
         echo "Sorry, the following problems were generated: ";
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
 }
開發者ID:aodkrisda,項目名稱:phalcon-code,代碼行數:14,代碼來源:tutorial-426.php

示例11: registerAction

 public function registerAction()
 {
     $user = new Users();
     $success = $user->save($this->request->getPost(), array('email', 'password', 'ime', 'prezime', 'datum_rodenja'));
     if ($success) {
         echo "Thanks for registering!";
     } else {
         echo "Sorry, the following problems were generated: ";
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
     $this->view->disable();
 }
開發者ID:bblazina,項目名稱:twitterclone,代碼行數:14,代碼來源:SignupController.php

示例12: enregistrementAction

 public function enregistrementAction()
 {
     $user = new Users();
     //Enregistrement et vérification des erreurs
     $success = $user->save($this->request->getPost(), array('nom', 'email'));
     if ($success) {
         echo "Merci de votre enregistrement !";
     } else {
         echo "Erreurs lors de l'enregistrement : ";
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
     $this->view->disable();
 }
開發者ID:leoarmand,項目名稱:Framework_Phalcon,代碼行數:15,代碼來源:InscriptionController.php

示例13: indexAction

 public function indexAction()
 {
     $form = new RegisterForm();
     if ($this->request->isPost()) {
         if ($form->isValid($this->request->getPost()) != false) {
             $user = new Users();
             $user->assign(array('name' => $this->request->getPost('name', 'striptags'), 'email' => $this->request->getPost('email'), 'number' => $this->request->getPost('number'), 'password' => $this->security->hash($this->request->getPost('password')), 'telephone' => $this->request->getPost('telephone')));
             if ($user->save()) {
                 return $this->dispatcher->forward(array('controller' => 'index', 'action' => 'index'));
             }
             $this->flash->error($user->getMessages());
         }
     }
     $this->view->form = $form;
 }
開發者ID:surzm,項目名稱:gohome,代碼行數:15,代碼來源:RegisterController.php

示例14: registerAction

 public function registerAction()
 {
     $user = new Users();
     // Сохраняем и проверяем на наличие ошибок
     $success = $user->save($this->request->getPost(), array('name', 'email'));
     if ($success) {
         echo "Спасибо за регистрацию!";
     } else {
         echo "К сожалению, возникли следующие проблемы: ";
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
     $this->view->disable();
 }
開發者ID:algolubev87,項目名稱:pigeon,代碼行數:15,代碼來源:SignupController.php

示例15: indexAction

 public function indexAction()
 {
     $user = new Users();
     $post = $this->request->getPost();
     foreach ($post as $key => $p_val) {
         if ($key == 'password') {
             $pw = md5($p_val);
             $user->password = $pw;
             continue;
         }
         $user->{$key} = $post[$key];
     }
     if (!$user->save()) {
         var_dump($user->getMessages());
     }
 }
開發者ID:lumberjacks,項目名稱:exchangewolf,代碼行數:16,代碼來源:RegisterController.php


注:本文中的Users::getMessages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。