HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Social login in guest module

I finished my custom theme, but have a couple of problems. The most important is problem with social login. How I can enable social login at guest module, at sign in view all work perfect.

Like here:

Comments

  • These should be displayed in the guest module already. Although they look different out of the box, IIRC.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • edited March 2015

    in guest.php view I have next code

    <?php if (!defined('APPLICATION')) exit(); ?>
    
       <?php echo T('Howdy, Stranger!'); ?>
       <?php echo T($this->MessageCode, $this->MessageDefault); ?>
       <?php $this->FireEvent('BeforeSignInButton'); ?>
    
       <?php
       $signInUrl = SignInUrl($this->_Sender->SelfUrl);
    
       if ($signInUrl) {
          echo '';
    
          echo Anchor(T('Sign In'), SignInUrl($this->_Sender->SelfUrl), 'Button Primary'.(SignInPopup() ? ' SignInPopup' : ''), array('rel' => 'nofollow'));
          $Url = RegisterUrl($this->_Sender->SelfUrl);
          if(!empty($Url))
             echo ' '.Anchor(T('Register', T('Apply for Membership', 'Register')), $Url, 'Button ApplyButton', array('rel' => 'nofollow'));
    
          echo '';
       }
       ?>
       <?php $this->FireEvent('AfterSignInButton'); ?>
    
    

    I researched how this icons added at signin page/popup.

    Code in view:

    ...
    $Methods = $this->Data('Methods', array());
    $SelectedMethod = $this->Data('SelectedMethod', array());
    $CssClass = count($Methods) > 0 ? ' MultipleEntryMethods' : ' SingleEntryMethod';
    ...
    if (count($Methods) > 0) {
        echo ''
            . Wrap('' . T('Or you can...') . '', 'div');
    
        foreach ($Methods as $Key => $Method) {
            $CssClass = 'Method Method_' . $Key;
            echo '',
            $Method['SignInHtml'],
            '';
        }
    
        echo '';
    }
    ....
    

    For this EntryController has method SignIn:

    public function SignIn($Method = FALSE, $Arg1 = FALSE) {
    ...
    // Additional signin methods are set up with plugins.
          $Methods = array();
    
          $this->SetData('Methods', $Methods);
          $this->SetData('FormUrl', Url('entry/signin'));
    
          $this->FireEvent('SignIn');
    ...
    

    For example in OpenId Plugin:

    class OpenIDPlugin extends Gdn_Plugin {
       public static $ProviderKey = 'OpenID';
    
       /// Methods ///
    
       protected function _AuthorizeHref($Popup = FALSE) {
          $Url = Url('/entry/openid', TRUE);
          $UrlParts = explode('?', $Url);
          parse_str(GetValue(1, $UrlParts, ''), $Query);
    
          $Path = '/'.Gdn::Request()->Path();
          $Query['Target'] = GetValue('Target', $_GET, $Path ? $Path : '/');
    
          if (isset($_GET['Target']))
             $Query['Target'] = $_GET['Target'];
          if ($Popup)
             $Query['display'] = 'popup';
    
          $Result = $UrlParts[0].'?'.http_build_query($Query);
          return $Result;
       }
    .....
    .....
    

    Do you have any idea?

  • I am seeing three hooks in use for connect plugins: Base_SignInIcons_Handler, Base_BeforeSignInButton_Handler, and Base_BeforeSignInLink_Handler. The guest module fires the BeforeSignInButton event (and an AfterSignInButton event).

    Did you override the guest module view? If you did, you need to fire the events where appropriate.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.