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


PHP ParseUser::signUp方法代碼示例

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


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

示例1: createUser

 /**
  * Creating new user
  * @param String $name User full name
  * @param String $email User login email id
  * @param String $password User login password
  */
 public function createUser(CustomParseUser $cpu)
 {
     $response = array();
     // First check if user already existed in db
     if (!$this->isUserExists($cpu->getUserName(), $cpu->getEmail())) {
         // Generating API key
         $api_key = $this->generateApiKey($cpu->getEmail());
         $user = new ParseUser();
         $user->set("username", $cpu->getUsername());
         $user->set("password", $cpu->getPassword());
         $user->set("email", $cpu->getEmail());
         $user->set("firstName", $cpu->getFirstName());
         $user->set("lastName", $cpu->getLastName());
         $user->set("birthday", $cpu->getBirthday());
         $user->set("apiKey", $api_key);
         try {
             $user->signUp();
             // Hooray! Let them use the app now.
             return 'USER_CREATED_SUCCESSFULLY';
         } catch (Parse\ParseException $ex) {
             // Show the error message somewhere and let the user try again.
             echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
             return 'USER_CREATE_FAILED';
         }
     } else {
         // User with same email already existed in the db
         return 'USER_ALREADY_EXISTED';
     }
     return $response;
 }
開發者ID:AdventureKing,項目名稱:EventFeast,代碼行數:36,代碼來源:DbHandler.php

示例2: register

function register($name, $email, $password, $teacher)
{
    $user = new ParseUser();
    $user->set("username", $email);
    $user->set("email", $email);
    $user->set("password", $password);
    $user->set("name", $name);
    if ($teacher == "true") {
        $user->set("Teacher", true);
    } else {
        $user->set("Teacher", false);
    }
    try {
        $user->signUp();
        $user->save();
        if ($teacher == "true") {
            header("Location: profile.php");
        } else {
            header("Location: howToLearn.php");
        }
        // Hooray! Let them use the app now.
    } catch (ParseException $ex) {
        // Show the error message somewhere and let the user try again.
    }
}
開發者ID:TiagoRechau,項目名稱:E-learning-for-elderly,代碼行數:25,代碼來源:register.php

示例3: singup

 public static function singup($name, $lastname, $email, $password)
 {
     if (!empty($name) && !empty($lastname) && !empty($email) && !empty($password)) {
         $cleanName = filter_var($name, FILTER_SANITIZE_STRING);
         $cleanLastName = filter_var($lastname, FILTER_SANITIZE_STRING);
         $cleanEmail = filter_var($email, FILTER_SANITIZE_EMAIL);
         $cleanPassword = filter_var($password, FILTER_SANITIZE_STRING);
         $user = new ParseUser();
         $user->set("username", $cleanEmail);
         $user->set("password", $cleanPassword);
         $user->set("email", $cleanEmail);
         $customer = self::createStripeId($cleanEmail);
         // other fields can be set just like with ParseObject
         $user->set("stripeId", $customer['id']);
         $user->set("name", $cleanName);
         $user->set("lastname", $cleanLastName);
         try {
             $user->signUp();
             return 200;
         } catch (ParseException $ex) {
             return 500;
         }
     } else {
         return 500;
     }
 }
開發者ID:GerardoDRM,項目名稱:BondzuWebApp,代碼行數:26,代碼來源:User.php

示例4: 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

示例5: signUp

 public function signUp($name, $password, $email)
 {
     $user = new ParseUser();
     $user->set("username", $name);
     $user->set("password", $password);
     $user->set("email", $email);
     try {
         $user->signUp();
     } catch (ParseException $ex) {
         echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
     }
     return $user->get('username');
 }
開發者ID:jdc7894,項目名稱:Parse-Practice,代碼行數:13,代碼來源:User.php

示例6: signup

function signup()
{
    $username = $_POST["id"];
    $user = new ParseUser();
    $user->set("username", $username);
    $user->set("password", $_POST["pass"]);
    $user->set("email", $username . "@example.com");
    try {
        $user->signUp();
        // Hooray! Let them use the app now.
    } catch (ParseException $ex) {
        // Show the error message somewhere and let the user try again.
        echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
    }
}
開發者ID:GaurabAryal,項目名稱:Fungeons-Web,代碼行數:15,代碼來源:AuthController.php

示例7: 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

示例8: 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

示例9: reguistraUsuario

 /**
  * Registra a un usuario nuevo tomando sus datos, si todo fue bien retorna el
  * objeto conteniendo al usuario, si no, retorna un mensaje de error.
  * @param type $nombre nombre del usuario
  * @param type $contraseña su contraseña
  * @param type $email el email del usuario
  * @param type $tipo el tipo de usuario (1 persona fisica, 2 persona moral).
  * @return objeto json
  */
 public static function reguistraUsuario($usuario)
 {
     $user = new ParseUser();
     $user->set("username", $usuario->getNombre());
     $user->set("password", $usuario->getPassword());
     $user->set("email", $usuario->getEmail());
     $user->set("tipo", $usuario->getTipo());
     try {
         $user->signUp();
         return json_encode([reg => 1, mensaje => 'Usuario registrado']);
     } catch (ParseException $ex) {
         if ($ex->getCode() == 203) {
             return json_encode([reg => 0, mensaje => "La direccion email " . $usuario->getEmail() . " ya esta ocupada"]);
         } else {
             if ($ex->getCode() == 202) {
                 return json_encode([reg => 0, mensaje => "El nombre de usuario " . $usuario->getNombre() . " ya esta ocupado"]);
             } else {
                 return json_encode([reg => 0, mensaje => $ex->getMessage()]);
             }
         }
     }
 }
開發者ID:sterben93,項目名稱:casa,代碼行數:31,代碼來源:APIUsuario.php

示例10: 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

示例11: 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

示例12: ParseUser

        }
        $file = ParseFile::createFromFile($target_dir . $name, "logo");
        $file->save();
        // create new user object
        $user = new ParseUser();
        $user->set("username", $email);
        $user->set("password", $pass);
        $user->set("email", $email);
        $user->set("corporate", true);
        $user->set("name", $company_name);
        $user->set("logo", $file);
        $user->set("logo_url", $file->getURL());
        unlink($target_dir . $name);
        // try signup
        try {
            $user->signUp();
            // Hooray! Let them use the app now.
            $_SESSION['login'] = "1";
            $_SESSION['email'] = $email;
            $_SESSION['userid'] = $user->getObjectId();
            header("Location: index.php");
        } catch (ParseException $ex) {
            // Show the error message somewhere and let the user try again.
            echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
        }
    }
}
echo include "assets/templates/header.php";
?>
<br>
<br>
開發者ID:shubDhond,項目名稱:MarketBngWeb,代碼行數:31,代碼來源:register.php

示例13: userSignUp

 public function userSignUp($params)
 {
     // creat new ParseUser object
     $user = new ParseUser();
     // set params
     foreach ($params as $name => $data) {
         switch ($data['type']) {
             case 'array':
                 $user->setArray($name, $data['value']);
                 break;
             default:
                 $user->set($name, $data['value']);
                 break;
         }
     }
     try {
         $user->signUp();
         return array('status' => '1', 'data' => $user);
     } catch (ParseException $e) {
         return array('status' => '0', 'data' => $e->getMessage());
     }
 }
開發者ID:alamops,項目名稱:codeigniter-parse-library,代碼行數:22,代碼來源:parse.php

示例14: user_register_report

function user_register_report($first, $last, $pass, $email, $report_id)
{
    $response = new Response();
    $name = $first . "_" . $last;
    $user = new ParseUser();
    $user->set("username", strtolower($name));
    $user->set("email", $email);
    $user->set("password", $pass);
    try {
        $user->signUp();
        $_SESSION['user'] = $user;
        $_SESSION['notification'] = true;
        $query = new ParseQuery("_Session");
        $query->equalTo("user", $user);
        $query->includeKey("user");
        $query->descending("createdAt");
        $query->limit(1);
        $new = $query->find(true);
        $_SESSION['last_date'] = date_format($new[0]->getCreatedAt(), 'Y-m-d\\TH:i:s.u\\Z');
        echo add_user_report($report_id, $user);
    } catch (ParseException $ex) {
        $response->success = false;
        $response->message = 'Error: Failed to register: ' . $error;
        echo json_encode($response);
    }
}
開發者ID:louk,項目名稱:One-Nice-Thing,代碼行數:26,代碼來源:common.php

示例15: doAddManager

 public function doAddManager($adminfName, $adminlName, $adminMail, $adminPass, $adminPerm)
 {
     # code...
     $currentUser = ParseUser::getCurrentUser();
     $dbusername = $this->session->userdata('username');
     $userDetails = $this->db->get_where('userdetails', ['username' => $dbusername])->row();
     $dbgetusername = $userDetails->username;
     $dbgetpassword = $userDetails->password;
     $user = new ParseUser();
     $user->set("username", $adminMail);
     $user->set("password", $adminPass);
     $user->set("email", $adminMail);
     $user->set("creator", $currentUser);
     // other fields can be set just like with ParseObject
     $user->set("firstName", $adminfName);
     $user->set("lastName", $adminlName);
     try {
         // Query for the role to be assigned to the owner of the company
         $role = new ParseObject("_Role");
         $query = new ParseQuery("_Role");
         $role = $query->get($adminPerm);
         $user->signUp();
         $role->getUsers()->add($user);
         $user->set("role", $role);
         $role->save();
         $user->save();
         ParseUser::logOut();
         $prevUser = ParseUser::logIn($dbgetusername, $dbgetpassword);
         // Hooray! Let them use the app now.
         return ['status' => true];
     } catch (ParseException $ex) {
         // Show the error message somewhere and let the user try again.
         // echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
         return ['status' => false, 'parseMsg' => $ex->getMessage()];
     }
 }
開發者ID:Lawrence94,項目名稱:sme4me,代碼行數:36,代碼來源:Signup_model.php


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