本文整理汇总了PHP中Parse\ParseUser::setPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseUser::setPassword方法的具体用法?PHP ParseUser::setPassword怎么用?PHP ParseUser::setPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseUser
的用法示例。
在下文中一共展示了ParseUser::setPassword方法的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;
}
示例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);
}
示例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']);
}
}
示例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);
}
示例5: createUser
public function createUser($username)
{
$user = new ParseUser();
$user->setUsername($username);
$user->setPassword($username);
return $user;
}
示例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'));
}
示例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());
}
示例8: setcookie
/* 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");
/* Redirect browser */
exit;