<bdo id='6DGyu'></bdo><ul id='6DGyu'></ul>
  • <tfoot id='6DGyu'></tfoot>

        <i id='6DGyu'><tr id='6DGyu'><dt id='6DGyu'><q id='6DGyu'><span id='6DGyu'><b id='6DGyu'><form id='6DGyu'><ins id='6DGyu'></ins><ul id='6DGyu'></ul><sub id='6DGyu'></sub></form><legend id='6DGyu'></legend><bdo id='6DGyu'><pre id='6DGyu'><center id='6DGyu'></center></pre></bdo></b><th id='6DGyu'></th></span></q></dt></tr></i><div id='6DGyu'><tfoot id='6DGyu'></tfoot><dl id='6DGyu'><fieldset id='6DGyu'></fieldset></dl></div>

        <small id='6DGyu'></small><noframes id='6DGyu'>

        <legend id='6DGyu'><style id='6DGyu'><dir id='6DGyu'><q id='6DGyu'></q></dir></style></legend>

        Facebook 使用 Sentry 登录,用户 [email] 需要密码,没有给出

        Facebook Login with Sentry, A password is required for user [email], none given(Facebook 使用 Sentry 登录,用户 [email] 需要密码,没有给出)
      1. <tfoot id='VLaYL'></tfoot>

        <small id='VLaYL'></small><noframes id='VLaYL'>

        <legend id='VLaYL'><style id='VLaYL'><dir id='VLaYL'><q id='VLaYL'></q></dir></style></legend>

            <bdo id='VLaYL'></bdo><ul id='VLaYL'></ul>
            <i id='VLaYL'><tr id='VLaYL'><dt id='VLaYL'><q id='VLaYL'><span id='VLaYL'><b id='VLaYL'><form id='VLaYL'><ins id='VLaYL'></ins><ul id='VLaYL'></ul><sub id='VLaYL'></sub></form><legend id='VLaYL'></legend><bdo id='VLaYL'><pre id='VLaYL'><center id='VLaYL'></center></pre></bdo></b><th id='VLaYL'></th></span></q></dt></tr></i><div id='VLaYL'><tfoot id='VLaYL'></tfoot><dl id='VLaYL'><fieldset id='VLaYL'></fieldset></dl></div>
                  <tbody id='VLaYL'></tbody>
                1. 本文介绍了Facebook 使用 Sentry 登录,用户 [email] 需要密码,没有给出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试允许用户使用 facebook 登录,但我的用户管理基于哨兵如您所知,如果您从 facebook 连接,除非您正常创建帐户,否则您不需要密码.有没有办法告诉哨兵(http://docs.cartalyst.com/sentry-2/installation/laravel-4)这是一个 facebook 登录,它不需要密码"

                  I'm trying to allow users to login using facebook but my user management is based on sentry as you know if you connect from facebook, you wont need a password unless you are creating a account normally. Is there a way to tell sentry(http://docs.cartalyst.com/sentry-2/installation/laravel-4) that this is a facebook login and it doesnt require a "password"

                  我尝试给帐户一个临时密码,但我收到了没有为用户提供散列器,即使我散列它.

                  I tried giving the account a temp password but i receive A hasher has not been provided for the user , even when i hash it.

                  对此有何建议?

                  我也在使用 http://maxoffsky.com/code-blog/integrating-facebook-login-into-laravel-application/ 作为指南

                  I'm also using http://maxoffsky.com/code-blog/integrating-facebook-login-into-laravel-application/ as a guide

                  Route::get('login/fb/callback', function() {
                  $code = Input::get('code');
                  if (strlen($code) == 0) return Redirect::to('/')->with('message', 'There was an error communicating with Facebook');
                  
                  $facebook = new Facebook(Config::get('facebook'));
                  $uid = $facebook->getUser();
                  
                  if ($uid == 0) return Redirect::to('/')->with('message', 'There was an error');
                  
                  $me = $facebook->api('/me');
                  
                  $profile = Profile::whereUid($uid)->first();
                  if (empty($profile)) {
                  
                      $user = new User;
                      $user->name = $me['first_name'].' '.$me['last_name'];
                      $user->email = $me['email'];
                      $user->photo = 'https://graph.facebook.com/'.$me['username'].'/picture?type=large';
                  
                      $user->save();
                  
                      $profile = new Profile();
                      $profile->uid = $uid;
                      $profile->username = $me['username'];
                      $profile = $user->profiles()->save($profile);
                  }
                  
                  $profile->access_token = $facebook->getAccessToken();
                  $profile->save();
                  
                  $user = $profile->user;
                  
                  Auth::login($user);
                  
                  return Redirect::to('/')->with('message', 'Logged in with Facebook');
                  

                  });

                  推荐答案

                  我正在考虑做类似的事情,并且正在考虑使用 facebook uid 作为密码.这不行吗?

                  I'm looking at doing something similar, and was thinking of using the facebook uid as the password. Would this not work?

                  我可以为我确认以下工作:

                  I can confirm the following works for me:

                  function callback()
                  {
                      $code = Input::get('code');
                      if (strlen($code) == 0) return Redirect::to('/')->with('message', 'There was an error communicating with Facebook');
                  
                      $facebook = new Facebook(Config::get('facebook'));
                      $uid = $facebook->getUser();
                  
                      if ($uid == 0) return Redirect::to('/')->with('message', 'There was an error');
                  
                      $me = $facebook->api('/me');
                      //dd($me);
                  
                      //Check if user profile exists
                      $profile = Profile::whereUid($uid)->first();
                      if (empty($profile)) {
                  
                          // Create the user
                          $user = Sentry::createUser(array(
                              'email'      => $me['email'],
                              'password'   => $uid,
                              'first_name' => $me['first_name'],
                              'last_name'  => $me['last_name'],
                              'photo'      =>  'https://graph.facebook.com/'.$me['username'].'/picture?type=large',
                              'activated'  => 1
                          ));
                  
                          // Find the group using the group id
                          $registered = Sentry::findGroupById(2);
                          // Assign the group to the user
                          $user->addGroup($registered);
                  
                          $profile = new Profile();
                          $profile->uid = $uid;
                          $profile->username = $me['username'];
                          $profile = $user->profiles()->save($profile);
                      }
                  
                      $profile->access_token = $facebook->getAccessToken();
                      $profile->save();
                  
                      $user = $profile->user;
                      Sentry::login($user, false);
                      $user = Sentry::getUser();
                  
                      echo $user->first_name . " logged in.";
                      //return Redirect::to('/')->with('message', 'Logged in with Facebook');
                  }
                  

                  另请注意,您需要使用此方法自定义哨兵使用的模型 (http://forums.laravel.io/viewtopic.php?pid=48274#p48274) 以指定与配置文件的关系

                  Also note that you'll need customize the model sentry uses using this method (http://forums.laravel.io/viewtopic.php?pid=48274#p48274) in order to specify the relationship with profiles

                  这篇关于Facebook 使用 Sentry 登录,用户 [email] 需要密码,没有给出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  • <legend id='qBjFD'><style id='qBjFD'><dir id='qBjFD'><q id='qBjFD'></q></dir></style></legend>
                    1. <small id='qBjFD'></small><noframes id='qBjFD'>

                          <tbody id='qBjFD'></tbody>
                      • <tfoot id='qBjFD'></tfoot>
                            <bdo id='qBjFD'></bdo><ul id='qBjFD'></ul>

                          • <i id='qBjFD'><tr id='qBjFD'><dt id='qBjFD'><q id='qBjFD'><span id='qBjFD'><b id='qBjFD'><form id='qBjFD'><ins id='qBjFD'></ins><ul id='qBjFD'></ul><sub id='qBjFD'></sub></form><legend id='qBjFD'></legend><bdo id='qBjFD'><pre id='qBjFD'><center id='qBjFD'></center></pre></bdo></b><th id='qBjFD'></th></span></q></dt></tr></i><div id='qBjFD'><tfoot id='qBjFD'></tfoot><dl id='qBjFD'><fieldset id='qBjFD'></fieldset></dl></div>