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


PHP Parse\ParseUser类代码示例

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


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

示例1: alerts

 public function alerts($cc = null)
 {
     $current_user = ParseUser::getCurrentUser();
     $query = new ParseQuery("Notifications");
     $query->equalTo("for", $current_user);
     $query->equalTo("read", false);
     $query->includeKey('by');
     $query->includeKey('message');
     try {
         $notifications = $query->find();
         $notes = array();
         foreach ($notifications as $notify) {
             if (!empty($notify->get('message'))) {
                 if ($notify->get('message')->get('chatRoom')->getObjectId() == $cc) {
                     $notify->set("read", true);
                     $notify->save();
                     continue;
                 }
                 $notes[] = ['id' => $notify->getObjectId(), 'for' => $notify->get('for')->getObjectId(), 'from' => ['id' => $notify->get('by')->getObjectId(), 'name' => $notify->get('by')->get('name')], 'message' => $notify->get('message')->get('message')];
             }
         }
         $ret = ['status' => "success", 'data' => ['notifications' => $notes]];
         return response()->json($ret);
     } catch (ParseException $ex) {
         $ret = ['status' => 'fail', 'error' => $ex->getMessage()];
         return response()->json($ret);
     }
 }
开发者ID:samphomsopha,项目名称:codelab,代码行数:28,代码来源:NotificationServiceController.php

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

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

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

示例5: isCurrentSessionRevocable

 /**
  * Determines whether the current session token is revocable.
  * This method is useful for migrating an existing app to use
  * revocable sessions.
  *
  * @return boolean
  */
 public static function isCurrentSessionRevocable()
 {
     $user = ParseUser::getCurrentUser();
     if ($user) {
         return self::_isRevocable($user->getSessionToken());
     }
 }
开发者ID:rcowick,项目名称:website,代码行数:14,代码来源:ParseSession.php

示例6: retrieveById

 /**
  * Retrieve a user by their unique identifier.
  *
  * @param  mixed $identifier
  *
  * @return \Illuminate\Contracts\Auth\Authenticatable|\LaraParse\Subclasses\User|null
  */
 public function retrieveById($identifier)
 {
     // check current user exist
     $currentUser = ParseUser::getCurrentUser();
     if ($currentUser->getObjectId() == $identifier) {
         return $currentUser;
     }
     $query = new ParseQuery('_User');
     return $query->get($identifier, true);
 }
开发者ID:redkyo017,项目名称:LaraParse,代码行数:17,代码来源:ParseUserProvider.php

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

示例8: authenticated

 /**
  * Show the form for creating a new resource.
  *
  * @return Bool
  */
 public static function authenticated()
 {
     try {
         ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
         $session = Cache::get('sessionToken', 'default');
         $user = ParseUser::become($session);
         return true;
     } catch (ParseException $error) {
         return false;
     }
 }
开发者ID:pietrodegrazia,项目名称:regulaSUSWeb,代码行数:16,代码来源:LoginController.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $this->current_user = ParseUser::getCurrentUser();
     if (!$this->current_user) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->route('login');
         }
     }
     return $next($request);
 }
开发者ID:samphomsopha,项目名称:codelab,代码行数:19,代码来源:Authenticate.php

示例10: resetPasswordAux

function resetPasswordAux($userName)
{
    try {
        console . log("entrei");
        window . alert("Email enviado");
        ParseUser::requestPasswordReset($userName);
        window . alert("Email enviado");
        // Password reset request was sent successfully
    } catch (ParseException $ex) {
        // Password reset failed, check the exception message
    }
}
开发者ID:TiagoRechau,项目名称:E-learning-for-elderly,代码行数:12,代码来源:settings.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     Log::info("PARSE AUTH");
     try {
         ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
         $session = Cache::get('sessionToken', 'default');
         $user = ParseUser::become($session);
         return $next($request);
     } catch (ParseException $error) {
         Log::info("PARSE AUTH ERROR: " . $error);
         return new RedirectResponse(url('/login'));
     }
 }
开发者ID:pietrodegrazia,项目名称:regulaSUSWeb,代码行数:20,代码来源:ParseAuthenticate.php

示例12: postLogIn

 public function postLogIn(ValidateLoginExpert $request)
 {
     $email = $request->get('email');
     $pass = $request->get('password');
     $user = ParseUser::logIn($email, $pass);
     $query = new ParseQuery("attractions");
     $currentUser = ParseUser::getCurrentUser();
     try {
         $attractions = $query->find();
         return view('expertTemplate.displayAttractions')->with('attractions', $attractions)->with('currentUser', $currentUser);
     } catch (ParseException $ex) {
     }
 }
开发者ID:aktn,项目名称:Laravel_TripPlan,代码行数:13,代码来源:ExpertController.php

示例13: enviarPush

/**
Envia la notificacion a cierto usuario
**/
function enviarPush()
{
    $_strName = $_POST['nombreUsuario'];
    $_strMenssage = $_POST['send'];
    // Find users near a given username
    $userQuery = ParseUser::query();
    $userQuery->equalTo("username", $_strName);
    // Find devices associated with these users
    $pushQuery = ParseInstallation::query();
    $pushQuery->matchesQuery('Usuarios', $userQuery);
    // Send push notification to query
    ParsePush::send(array("where" => $pushQuery, "data" => array("alert" => "{$_strMenssage}")));
}
开发者ID:ericzubin,项目名称:PUSHWEB,代码行数:16,代码来源:enviarPushnumero.php

示例14: get_user_data

 public function get_user_data($username, $credentials)
 {
     ParseClient::initialize($credentials->app_id, $credentials->rest_key, $credentials->master_key);
     $query = ParseUser::query();
     $query->equalTo('username', $username);
     $result = $query->find();
     $user = $result[0];
     $data = new stdClass();
     $data->fullName = $user->get("fullName");
     $data->avatar = $user->get("avatar");
     $data->title = $user->get("title");
     return $data;
 }
开发者ID:Omar-Faramawi,项目名称:codeigniter-eventrib-project,代码行数:13,代码来源:application_parse.php

示例15: logOut

 /**
  * LOGOUT A USER
  *
  * @return void
  */
 public function logOut()
 {
     try {
         ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
         $session = Cache::get('sessionToken', 'default');
         $user = ParseUser::become($session);
         Cache::forget('sessionToken');
         $user->logOut();
         return Redirect::to('login');
     } catch (ParseException $error) {
         dd($error);
     }
 }
开发者ID:pietrodegrazia,项目名称:regulaSUSWeb,代码行数:18,代码来源:LogoutController.php


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