Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for passing along extra parameters to the `FB.login` API

call (`FB_LOGIN`).
  • Loading branch information...
commit 8a8f9902b4c7a1f5d079d1422be2976b51e5b7b9 1 parent a58587e
@pennersr authored
View
5 ChangeLog
@@ -1,3 +1,8 @@
+2013-02-09 Raymond Penners <raymond.penners@intenct.nl>
+
+ * Added support for passing along extra parameters to the
+ `FB.login` API call (`FB_LOGIN`).
+
2013-01-30 Raymond Penners <raymond.penners@intenct.nl>
* Version 0.9.0 released.
View
11 README.rst
@@ -253,6 +253,13 @@ SOCIALACCOUNT_PROVIDERS (= dict)
Upgrading
---------
+From 0.9.0
+**********
+
+- The template variable `facebook_perms` is no longer passed to the
+ "facebook/fbconnect.html" template. Instead, `fb_login_options`
+ containing all options is passed.
+
From 0.8.3
**********
@@ -412,6 +419,7 @@ The following Facebook settings are available::
SOCIALACCOUNT_PROVIDERS = \
{ 'facebook':
{ 'SCOPE': ['email', 'publish_stream'],
+ 'FB_LOGIN': { 'auth_type': 'reauthenticate' },
'METHOD': 'oauth2' ,
'LOCALE_FUNC': 'path.to.callable'} }
@@ -429,6 +437,9 @@ internationalization/>`_ as a string::
{ 'facebook':
{ 'LOCALE_FUNC': lambda request: 'zh_CN'} }
+Use `FB_LOGIN` to pass along other parameters to the `FB.login` JS SDK
+call.
+
Google
------
View
13 allauth/socialaccount/providers/facebook/provider.py
@@ -1,7 +1,10 @@
+import json
+
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured
from django.template.loader import render_to_string
from django.template import RequestContext
+from django.utils.html import mark_safe
from allauth.utils import import_callable
from allauth.socialaccount import providers
@@ -70,8 +73,13 @@ def get_default_scope(self):
scope.append('email')
return scope
+ def get_fb_login_options(self):
+ settings = self.get_settings()
+ ret = settings.get('FB_LOGIN', {})
+ ret['scope'] = ','.join(self.get_scope())
+ return ret
+
def media_js(self, request):
- perms = ','.join(self.get_scope())
locale = self.get_locale_for_request(request)
try:
app = self.get_app(request)
@@ -79,10 +87,11 @@ def media_js(self, request):
raise ImproperlyConfigured("No Facebook app configured: please"
" add a SocialApp using the Django"
" admin")
+ fb_login_options = self.get_fb_login_options()
ctx = {'facebook_app': app,
'facebook_channel_url':
request.build_absolute_uri(reverse('facebook_channel')),
- 'facebook_perms': perms,
+ 'fb_login_options': mark_safe(json.dumps(fb_login_options)),
'facebook_jssdk_locale': locale}
return render_to_string('facebook/fbconnect.html',
ctx,
View
2  allauth/socialaccount/providers/facebook/templates/facebook/fbconnect.html
@@ -27,7 +27,7 @@
}
window.location.href = next;
}
- }, {scope: '{{facebook_perms}}' });
+ }, {{fb_login_options}});
}
};
(function(d){
Please sign in to comment.
Something went wrong with that request. Please try again.