コード例 #1
0
 /**
  * @param Request $request
  * @param Response $response
  */
 public function signupUser(Request $request, Response $response)
 {
     $username = $request->getParam('username');
     $password = $request->getParam('password');
     $email = $request->getParam('email');
     $u = $this->em->getRepository('App\\Model\\User')->findOneBy(array('username' => $username));
     if ($u != []) {
         echo "Username nay da ton tai";
     } else {
         $user = new User();
         $user->setUsername($username);
         $user->setPassword($password);
         $user->setEmail($email);
         $this->em->persist($user);
         $this->em->flush();
         echo "Da them thanh vien moi thanh cong";
     }
 }
コード例 #2
0
ファイル: auth.php プロジェクト: JefferyWong/adapi
 }
 if ($nation == '' || $nation == null) {
     $app->response->headers->set('Content-Type', 'application/json');
     echo Util::resPonseJson($app, 4000, "nation cannot be null", array());
     exit;
 }
 //     $existeSystemId = $em->createQuery('SELECT u FROM App\Model\User u WHERE u.system_id = '.$systemId);
 $existSystemId = $em->getRepository('App\\Model\\User')->findOneBy(array('system_id' => $systemId));
 if ($existSystemId) {
     $app->response->headers->set('Content-Type', 'application/json');
     echo Util::resPonseJson($app, 4001, "User has existed", array());
     exit;
 }
 $user = new User();
 $user->setSystem_id($systemId);
 $user->setUsername($username);
 $user->setPassword_hash(password_hash($password, PASSWORD_BCRYPT));
 $user->setBirthday(strtotime($birthday));
 $user->setHome_town($home_town);
 $user->setId_number($id_number);
 $user->setNation($nation);
 $user->setPhone($phone);
 $user->setInviter($inviter);
 $user->setSex($sex);
 $user->setStatus(1);
 $user->setCreated_at(time());
 $user->setUpdated_at(time());
 $user->setPayment_password("");
 try {
     $em->persist($user);
     $em->flush();
コード例 #3
0
ファイル: Provider.php プロジェクト: blazarecki/stage1
 /**
  * @param string $accessToken
  *
  * @return User
  */
 public function createUser($accessToken)
 {
     $data = $this->getUserData($accessToken);
     $user = new User();
     $user->setLoginProviderUserId($data['id']);
     $user->setLoginProviderName($this->getName());
     $user->setUsername($data['login']);
     if (isset($data['email']) && strlen($data['email']) > 0) {
         $user->setEmail($data['email']);
     }
     return $user;
 }