From #2067053: Popup window size (width and height).
**********
Hi,

I am using Hybrid Auth -7.x-2.7.
I need a custom popup instead of the current window type. I am using lightbox module and also ctools module. I found in your module that a js file from cTools module should be included to get the modal dialog.
Can you explain the procedure or provide a link so that I can learn myself.

Thanks,
Kiran
**********
Is there any solution for this?
Can't we use custom popups for the HybridAuth logins?

Comments

kirantej_p’s picture

Hi Andy,

Can you provide any reply for that. I have been looking around to find a solution. Could you provide some documentation for it.

Thanks,
Kiran

duozersk’s picture

Title: Custom Popup » Support authentication in modal popup
Assigned: Unassigned » duozersk

Kiran,

As I understood, you want to have authentication provider login/confirmation window to open in a custom modal window (not the 2 types provided by the module - usual popup window and the current window). Please confirm that this is what you want to achieve.
Side note: the ctools modal is used by this module to provide 2 widget types - one single icon or a link leading to the modal with the authentication providers icons.

For the options you have (lightbox and ctools modal) - ctools modal can't open external sites' content in it, only content from your site can be opened in it. You can try to make what you want using the lightbox. To change what happens when a user clicks on the authentication provider link you should modify the '#hybridauth_onclick' property of the widget element to contain the custom js code that will open the link in the lightbox modal.
The module itself uses this js code to open a usual popup.

popup_window = window.open(this.href, 'hybridauth', 'location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no,channelmode=yes,fullscreen=yes,width=800,height=500');
popup_window.focus();
return false;

You should modify this to open a lightbox modal (provided that the lightbox library is already present on the page).

Hope it helps.

Another note - it might be a good idea to add support for different popular modals to this module, I will think about it.

Thanks
AndyB

kirantej_p’s picture

Thanks Andy, This is what I am looking for. I will try to include lightbox modal and will reply you back.

Thanks again.

kirantej_p’s picture

Hey, I tried Lightbox module. I have modified some code in the hybridauth.theme.inc file. It comes with a lightbox popup and it is logging in an iframe, but the problem is the popup window is not closed and the site itself is opening in that Lightbox popup.

duozersk’s picture

Kiran,

Good-good, glad it helped you to get started. But you'd better not hack the module files ;) There are other ways to achieve what you need in Drupal - form alters (to change the '#hybridauth_onclick' property as I indicated above) and theme functions overriding.
Anyway, could you please post the code you used so that I can test it and commit to the main stream?

To make the site to dismiss the modal window and open in the main window we need to change the hybridauth_window_close() function - hybridauth.pages.inc file, line 67 - we need to modify the JS code added there to determine the parent and change its location.

Thanks
AndyB

kirantej_p’s picture

Hi,

Just added this in the foreach loop removed 'rel' => array('nofollow') and added 'rel' => array('lightframe') to get the lightbox iframe functionality, in hybridauth.theme.inc file. Also made $onclick value as null.

The problem here is, it is opening as an iframe, so the site also loads in it after successful authentication.

This is all what I did and I am struck here. Just post here if you are having any new update about this.

Thanks,
Kiran

duozersk’s picture

Committed - http://drupalcode.org/project/hybridauth.git/commit/4d6192a

Please download the snapshot release from this commit - http://drupalcode.org/project/hybridauth.git/snapshot/4d6192a.tar.gz - update the module code and then set the Authentication window type to "Lightbox2" in the HybridAuth module settings.

Thanks
AndyB

duozersk’s picture

Some notes: my tests have shown that some authentication providers (Twitter, LinkedIn) won't work inside an iframe - be careful with that.

Thanks
AndyB

duozersk’s picture

Status: Active » Fixed

Last commit - http://drupalcode.org/project/hybridauth.git/commit/8c82cf2 - adds support for shadowbox and fancybox.

AndyB

kirantej_p’s picture

Hi,

Thanks for your commits and fast response. It is not working for Google also. It is working for Facebook. The login is facebook is happening but on success, it is not reloaded or the pop up is not closing. This is the same situation I faced yesterday.

Thanks,
Kiran

duozersk’s picture

Kiran,

This is strange... cause it works when I test it. Could you please download the latest dev release from http://drupalcode.org/project/hybridauth.git/snapshot/8c82cf2.tar.gz and try it? It might also be related to browser cache...

Thanks
AndyB

kirantej_p’s picture

Yes, It is browser cache problem. It is perfectly working for Facebook, but for Google, it is not accepting to load in an iframe.

Thanks,
Kiran

duozersk’s picture

Yep, and there is nothing we can actually do about it... Google should go either through the same window or the popup window. Probably it would be good to make the "Authentication window type" setting per provider.

AndyB

duozersk’s picture

kirantej_p’s picture

Yes. Authentication window type based on provider is good.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated the related issue title