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


PHP UserMapper::getUserByEmail方法代码示例

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


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

示例1: findAction

 public function findAction()
 {
     $request = new Request();
     $request->initRequest();
     $post = $request->getPost();
     $roadMapper = new RoadMapper();
     $roads = $roadMapper->getByStartFinish($post['departure_point'], $post['destination_point'], "opened");
     $userMapper = new UserMapper();
     $carMapper = new CarMapper();
     $result = array();
     if ($roads) {
         foreach ($roads as $road) {
             $user = $userMapper->getUserByEmail($road->driverid);
             $car = $carMapper->getByAutoId($road->autoid);
             $roadMapper->clear();
             $getPoints = $roadMapper->getRoutPointsByRoad($road->id);
             $routPoints = array();
             foreach ($getPoints as $point) {
                 $routPoints[$point->pointqueue] = $point->point;
             }
             $result[] = array('startdate' => $road->startdate, 'start' => $road->start, 'start_adress' => $road->start_adress, 'finish' => $road->finish, 'finish_adress' => $road->finish_adress, 'freeseats' => $road->freeseats, 'price' => $road->price, 'terms' => $road->terms, 'rout_points' => $routPoints, 'username' => $user->username, 'surname' => $user->surname, 'rate' => $user->rate, 'photo' => $user->photo, 'age' => $user->getAge(), 'car_brand' => $car->brand, 'car_model' => $car->model);
             $userMapper->clear();
             $carMapper->clear();
             $roadMapper->clear();
         }
     }
     echo json_encode($result);
 }
开发者ID:G-Grand,项目名称:webosen2014_diplom,代码行数:28,代码来源:RoadController.php

示例2: usernameReminder

 public function usernameReminder($request, $db)
 {
     $user_mapper = new UserMapper($db, $request);
     $email = filter_var($request->getParameter("email"), FILTER_VALIDATE_EMAIL);
     if (empty($email)) {
         throw new Exception("The email address must be supplied", 400);
     } else {
         $list = $user_mapper->getUserByEmail($email);
         if (is_array($list['users']) && count($list['users'])) {
             $user = $list['users'][0];
             $recipients = array($email);
             $emailService = new UserUsernameReminderEmailService($this->config, $recipients, $user);
             $emailService->sendEmail();
             header("Content-Length: 0", NULL, 202);
             exit;
         }
         throw new Exception("Can't find that email address", 400);
     }
 }
开发者ID:e3betht,项目名称:joindin-api,代码行数:19,代码来源:EmailsController.php

示例3: updateUser

 /**
  * Allow a user to edit their own record
  *
  * @param Request $request the request.
  * @param         $db      the database.
  *
  * @return mixed
  */
 public function updateUser(Request $request, $db)
 {
     if (false === $request->getUserId()) {
         throw new Exception("You must be logged in to change a user account", 400);
     }
     $userId = $this->getItemId($request);
     $user_mapper = new UserMapper($db, $request);
     if ($user_mapper->thisUserHasAdminOn($userId)) {
         $oauthModel = $request->getOauthModel($db);
         $accessToken = $request->getAccessToken();
         // only trusted clients can change account details
         if (!$oauthModel->isAccessTokenPermittedPasswordGrant($accessToken)) {
             throw new Exception("This client does not have permission to perform this operation", 403);
         }
         // start building up a representation of the user
         $user = array("user_id" => $userId);
         $errors = array();
         // start with passwords
         $password = $request->getParameter('password');
         if (!empty($password)) {
             // they must supply their old password to be allowed to set a new one
             $old_password = $request->getParameter('old_password');
             if (empty($old_password)) {
                 throw new Exception('The field "old_password" is needed to update a user password', 400);
             }
             // is the old password correct before we proceed?
             if (!$oauthModel->reverifyUserPassword($userId, $old_password)) {
                 throw new Exception("The credentials could not be verified", 403);
             }
             $validity = $user_mapper->checkPasswordValidity($password);
             if (true === $validity) {
                 // OK good, go ahead
                 $user['password'] = $password;
             } else {
                 // the password wasn't acceptable, tell the user why
                 $errors = array_merge($errors, $validity);
             }
         }
         $user['full_name'] = filter_var(trim($request->getParameter("full_name")), FILTER_SANITIZE_STRING);
         if (empty($user['full_name'])) {
             $errors[] = "'full_name' is a required field";
         }
         $user['email'] = filter_var(trim($request->getParameter("email")), FILTER_VALIDATE_EMAIL);
         if (empty($user['email'])) {
             $errors[] = "A valid entry for 'email' is required";
         } else {
             // does anyone else have this email?
             $existing_user = $user_mapper->getUserByEmail($user['email']);
             if ($existing_user['users']) {
                 // yes but is that our existing user being found?
                 $old_user = $user_mapper->getUserById($userId);
                 if ($old_user['users'][0]['uri'] != $existing_user['users'][0]['uri']) {
                     // the email address exists and not on this user's account
                     $errors[] = "That email is already associated with another account";
                 }
             }
         }
         // Optional Fields
         $twitter_username = $request->getParameter("twitter_username", false);
         if (false !== $twitter_username) {
             $user['twitter_username'] = filter_var(trim($twitter_username), FILTER_SANITIZE_STRING);
         }
         if ($errors) {
             throw new Exception(implode(". ", $errors), 400);
         } else {
             // now update the user
             if (!$user_mapper->editUser($user, $userId)) {
                 throw new Exception("User not updated", 400);
             }
             // we're good!
             header("Content-Length: 0", null, 204);
             exit;
             // no more content
         }
     }
     throw new Exception("Could not update user", 400);
 }
开发者ID:asgrim,项目名称:joindin-api,代码行数:85,代码来源:UsersController.php

示例4: saveAction

 public function saveAction()
 {
     $message = ErMessenger::getInstance();
     $request = new Request();
     $request->initRequest();
     $post = $request->getPost();
     if (isset($post)) {
         $userEmail = ErSession::getFromSession('user');
         $userMapper = new UserMapper();
         $user = $userMapper->getUserByEmail($userEmail);
         $user->username = $this->clearStr($post['username']);
         $user->surname = $this->clearStr($post['surname']);
         $user->birthday = $this->clearStr($post['birthday']);
         $user->gendor = $this->clearStr($post['gendor']);
         $user->phone = $this->clearStr($post['phone']);
         if ($post['password_changed']) {
             $user->userpassword = hash("md5", $this->clearStr($post['userpassword']));
         }
         $userMapper->clear();
         if ($userMapper->updateUser($user)) {
             $message->setSucceedMessage('202', 'user/private');
         } else {
             $message->setErrMessage('100', 'user/private');
         }
         echo json_encode($this->fetchUserData($userEmail));
     }
 }
开发者ID:G-Grand,项目名称:webosen2014_diplom,代码行数:27,代码来源:UserController.php


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