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


PHP ParseUser::getUsername方法代碼示例

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


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

示例1: dispatch

 /**
  * Dispatch is called before the action, using this to make sure any request to the app without an authenticated
  * user is directed to the signin,
  *
  * @param Request $request
  * @param Response $response
  * @return mixed|\Zend\Http\Response|Response
  */
 public function dispatch(Request $request, Response $response = null)
 {
     $this->user = ParseUser::getCurrentUser();
     if (!$this->user or !isset($_SESSION['todo']['user']) or $this->user->getUsername() !== $_SESSION['todo']['user']) {
         return $this->redirect()->toRoute('auth', ['action' => 'signin']);
     }
     return parent::dispatch($request, $response);
     // TODO: Change the autogenerated stub
 }
開發者ID:mkhuramj,項目名稱:ToDo-Web,代碼行數:17,代碼來源:AppController.php

示例2: testUserAttributes

 public function testUserAttributes()
 {
     $user = new ParseUser();
     $user->setUsername('asdf');
     $user->setPassword('zxcv');
     $user->setEmail('asds@mail.com');
     $this->assertEquals('asdf', $user->getUsername());
     $this->assertEquals('asds@mail.com', $user->getEmail());
 }
開發者ID:aglo35,項目名稱:vr_beta,代碼行數:9,代碼來源:ParseUserTest.php

示例3: signupAction

 /**
  * Expects a post with email / password (or the form is just shown). Creates a new user (if possible) then redirects
  * to the app controller on success, or itself (PRG) with a flash message on error.
  */
 public function signupAction()
 {
     if (!$this->request instanceof Request or !$this->request->isPost()) {
         return;
         //nothing to do
     }
     $email = $this->request->getPost('email');
     $password = $this->request->getPost('password');
     $user = new ParseUser();
     $user->setUsername($email);
     $user->setPassword($password);
     try {
         $user->signUp();
         $_SESSION['todo']['user'] = $user->getUsername();
         $this->redirect()->toRoute('app');
     } catch (ParseException $e) {
         $this->flashMessenger()->addErrorMessage($e->getMessage());
         $this->redirect()->toRoute('auth', ['action' => 'signup']);
     }
 }
開發者ID:mkhuramj,項目名稱:ToDo-Web,代碼行數:24,代碼來源:AuthController.php


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