public function logged_in($type)
 {
     $userData = Socialite::with($type)->user();
     $email = $userData->email;
     if (empty($email)) {
         //Fallback on nickname for twitter
         $email = $userData->nickname;
     }
     //TODO: Save email/nickname in login column
     //TODO: Add displayname and ask for it after login
     //TODO: Ask for email after login
     $user = User::firstOrNew(['email' => $email, 'name' => $userData->name]);
     $user->save();
     Auth::login($user, true);
     return redirect('/');
 }
Exemplo n.º 2
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param array $data
  *
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }