当前位置: 首页>>代码示例>>PHP>>正文


PHP ParseUser::setUsername方法代码示例

本文整理汇总了PHP中Parse\ParseUser::setUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseUser::setUsername方法的具体用法?PHP ParseUser::setUsername怎么用?PHP ParseUser::setUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parse\ParseUser的用法示例。


在下文中一共展示了ParseUser::setUsername方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createUser

 public function createUser($params)
 {
     $user = new ParseUser();
     $user->setUsername($params['login']);
     $user->setPassword($params['passwd']);
     try {
         $user->signUp();
     } catch (ParseException $ex) {
         die("Exception: " . $ex->getMessage());
     }
     return $user;
 }
开发者ID:robinraintama,项目名称:parse-php-cms,代码行数:12,代码来源:Cms.php

示例2: testRevocableSession

 public function testRevocableSession()
 {
     ParseClient::enableRevocableSessions();
     $user = new ParseUser();
     $user->setUsername("username");
     $user->setPassword("password");
     $user->signUp();
     $session = ParseSession::getCurrentSession();
     $this->assertEquals($user->getSessionToken(), $session->getSessionToken());
     $this->assertTrue($session->isCurrentSessionRevocable());
     ParseUser::logOut();
     ParseUser::logIn("username", "password");
     $session = ParseSession::getCurrentSession();
     $this->assertEquals(ParseUser::getCurrentUser()->getSessionToken(), $session->getSessionToken());
     $this->assertTrue($session->isCurrentSessionRevocable());
     $sessionToken = $session->getSessionToken();
     ParseUser::logOut();
     $this->setExpectedException('Parse\\ParseException', 'invalid session token');
     ParseUser::become($sessionToken);
 }
开发者ID:louk,项目名称:https---github.com-soninod-Hello,代码行数:20,代码来源:ParseSessionTest.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

示例4: getIndex

 /**
  * Show the profile for the given user.
  *
  * @param  int  $id
  * @return Response
  */
 public function getIndex()
 {
     ParseClient::initialize(env('PARSE_APP_ID'), env('ARSE_REST_KEY'), env('PARSE_MASTER_KEY'));
     $user = new ParseUser();
     $user->setUsername("foo");
     $user->setPassword("Q2w#4!o)df");
     try {
         $user->signUp();
         dd(1112);
     } catch (ParseException $ex) {
         echo $ex->getMessage() . "<br>";
     }
     // Login
     try {
         $user = ParseUser::logIn("foo", "Q2w#4!o)df");
     } catch (ParseException $ex) {
         echo $ex->getMessage();
     }
     // Current user
     $user = ParseUser::getCurrentUser();
     dd($user);
 }
开发者ID:varyan,项目名称:tratesTrates,代码行数:28,代码来源:TestController.php

示例5: createUser

 public function createUser($username)
 {
     $user = new ParseUser();
     $user->setUsername($username);
     $user->setPassword($username);
     return $user;
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:7,代码来源:ParseRoleTest.php

示例6: dtestCurrentUserIsNotDirty

 public function dtestCurrentUserIsNotDirty()
 {
     $user = new ParseUser();
     $user->setUsername('asdf');
     $user->setPassword('zxcv');
     $user->set('bleep', 'bloop');
     $user->signUp();
     $this->assertFalse($user->isKeyDirty('bleep'));
     $userAgain = ParseUser::getCurrentUser();
     $this->assertFalse($userAgain->isKeyDirty('bleep'));
 }
开发者ID:nidalb,项目名称:baas,代码行数:11,代码来源:ParseUserTest.php

示例7: testACLModifyingAfterLoad

 public function testACLModifyingAfterLoad()
 {
     $user = new ParseUser();
     $user->setUsername('alice');
     $user->setPassword('wonderland');
     $user->signUp();
     $object = ParseObject::create('Object');
     $acl = ParseACL::createACLWithUser($user);
     $object->setACL($acl);
     $object->save();
     $this->assertTrue($object->getACL()->getUserReadAccess($user));
     $this->assertTrue($object->getACL()->getUserWriteAccess($user));
     $this->assertFalse($object->getACL()->getPublicReadAccess());
     $this->assertFalse($object->getACL()->getPublicWriteAccess());
     $query = new ParseQuery('Object');
     $objectAgain = $query->get($object->getObjectId());
     $objectAgain->getACL()->setPublicReadAccess(true);
     $this->assertTrue($objectAgain->getACL()->getUserReadAccess($user));
     $this->assertTrue($objectAgain->getACL()->getUserWriteAccess($user));
     $this->assertTrue($objectAgain->getACL()->getPublicReadAccess());
     $this->assertFalse($objectAgain->getACL()->getPublicWriteAccess());
 }
开发者ID:rvdavid,项目名称:parse-php-sdk,代码行数:22,代码来源:ParseACLTest.php

示例8: setcookie

        setcookie("regError", "Password must contain numbers");
        header("Location: index.php");
        /* Redirect browser */
        exit;
    }
    //Will remove any numbers, thus if it is all numbers the length will be 0
    if (preg_match('/[a-zA-Z]/', $pass) == 0) {
        setcookie("regError", "Password must contain letters");
        header("Location: index.php");
        /* Redirect browser */
        exit;
    }
    /* set session storage */
    ParseClient::setStorage(new ParseSessionStorage());
    try {
        $user->setUsername($_POST["username"]);
        $user->setEmail($_POST["username"]);
        $user->setPassword($_POST["password"]);
        $user->set("friendlyName", $_POST["friendly"]);
        $user->set("isAdmin", TRUE);
        $user->signUp();
        $_SESSION["username"] = ParseUser::getCurrentUser()->get("username");
        $_SESSION["friendlyName"] = ParseUser::getCurrentUser()->get("friendlyName");
    } catch (ParseException $ex) {
        // error in $ex->getMessage();
        setcookie("regError", $ex->getMessage());
    }
} else {
    setcookie("regError", "Username, Password, and Chat Name are required");
}
header("Location: index.php");
开发者ID:CDMayberry,项目名称:PingITWeb,代码行数:31,代码来源:register.php


注:本文中的Parse\ParseUser::setUsername方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。