I'm sorry, made a typo in patch above. Also changed code to be backwards 
compatible with older web2py versions.

Updated PR and added new patch. 

Op vrijdag 20 december 2013 20:58:11 UTC+1 schreef Peter Govers:
>
> It seems the Jainrain Legacy Sign-in Widget has hit its end-of-life and 
> has been replaced by Social Sign-in Widget.
>
> I've changed RPXAccount login_form 
> (gluon/contrib/login_methods/rpc_account.py) to migrate Janrain's Legacy 
> Sign-in Widget to the current Social Sign-in Widget. For more info: 
> http://developers.janrain.com/documentation/widgets/legacy-sign-in-widget/social-sign-in-migration-guide/
>
> I added a pull request on GitHub and also included a patch as attachment.
>
>
> Op vrijdag 20 december 2013 20:02:15 UTC+1 schreef Rene Dohmen:
>>
>> Hi,
>>
>> We use the janrain login method in a couple of our webapps. As of today 
>> it suddenly stopped working...
>>
>> Are there any other users that use the janrain login methods? (and have 
>> it working?)
>>
>> On the janrain site I found a story about and old and a new way to use 
>> janrain. The Iframe way seems deprecated.
>>
>> Kind Regards Rene
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
diff --git a/gluon/contrib/login_methods/rpx_account.py b/gluon/contrib/login_methods/rpx_account.py
index 0cd1c56..d8c47eb 100644
--- a/gluon/contrib/login_methods/rpx_account.py
+++ b/gluon/contrib/login_methods/rpx_account.py
@@ -98,27 +98,32 @@ class RPXAccount(object):
     def login_form(self):
         request = self.request
         args = request.args
-        if self.embed:
-            JANRAIN_URL = \
-                "https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s";
-            rpxform = IFRAME(
-                _src=JANRAIN_URL % (
-                    self.domain, self.token_url, self.language),
-                _scrolling="no",
-                _frameborder="no",
-                             _style="width:400px;height:240px;")
-        else:
-            JANRAIN_URL = \
-                "https://%s.rpxnow.com/openid/v2/signin?token_url=%s";
-            rpxform = DIV(SCRIPT(_src="https://rpxnow.com/openid/v2/widget";,
-                                 _type="text/javascript"),
-                          SCRIPT("RPXNOW.overlay = true;",
-                                 "RPXNOW.language_preference = '%s';" % self.language,
-                                 "RPXNOW.realm = '%s';" % self.domain,
-                                 "RPXNOW.token_url = '%s';" % self.token_url,
-                                 "RPXNOW.show();",
-                                 _type="text/javascript"))
-        return rpxform
+        rpxform = """
+        <script type="text/javascript">
+        (function() {
+            if (typeof window.janrain !== 'object') window.janrain = {};
+            if (typeof window.janrain.settings !== 'object') window.janrain.settings = {};
+            janrain.settings.tokenUrl = '%s';
+            function isReady() { janrain.ready = true; };
+            if (document.addEventListener) {
+                document.addEventListener("DOMContentLoaded", isReady, false);
+            } else {
+                window.attachEvent('onload', isReady);
+            }
+            var e = document.createElement('script');
+            e.type = 'text/javascript';
+            e.id = 'janrainAuthWidget';
+            if (document.location.protocol === 'https:') {
+                e.src = 'https://rpxnow.com/js/lib/%s/engage.js';
+            } else {
+                e.src = 'http://widget-cdn.rpxnow.com/js/lib/%s/engage.js';
+            }
+            var s = document.getElementsByTagName('script')[0];
+            s.parentNode.insertBefore(e, s);
+        })();
+        </script>
+        <div id="janrainEngageEmbed"></div>""" % (self.token_url, self.domain, self.domain)
+        return XML(rpxform)
 
 
 def use_janrain(auth, filename='private/janrain.key', **kwargs):

Reply via email to