Ejemplo n.º 1
0
 public function connectUser($user)
 {
     if (!($profile = $this->getUserProfile())) {
         return false;
     }
     $fbuser = FacebookUser::where("id", $profile->getId())->first();
     if ($fbuser && $fbuser->user_id == 0) {
         $fbuser->user_id = $user->id;
         $fbuser->save();
         $this->facebookUser = $fbuser;
         $this->getFriends();
         return $fbuser;
     }
     if ($fbuser) {
         return false;
     }
     $fbuser = $this->createFacebookUser($profile);
     $fbuser->user_id = $user->id;
     $fbuser->save();
     $this->facebookUser = $fbuser;
     $this->getFriends();
     return $fbuser;
 }
Ejemplo n.º 2
0
 public function postRegister(Request $request)
 {
     $validator = $this->registrar->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $user = $this->registrar->create($request->all());
     Log::error($this->session->all());
     Log::error(array_get($this->session->all(), 'facebookUser_id'));
     if (array_has($this->session->all(), 'facebookUser_id')) {
         Log::error(array_get($this->session->all(), 'facebookUser_id'));
         $fb = FacebookUser::find(array_get($this->session->all(), 'facebookUser_id'));
         $fb->user_id = $user->id;
         $fb->save();
         $this->session->forget('facebookUser_id');
     }
     $this->auth->login($user);
     //flash()->warning('Please verify your E-Mail to login.');
     //return redirect('auth/login');
     return redirect('user/' . $user->username);
 }