Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*_PERMS and *_perms to _scope #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the following settings:
FACEBOOK_SECRET_KEY = ''

# Optionally set default permissions to request, e.g: ['email', 'user_about_me']
FACEBOOK_PERMS = []
FACEBOOK_SCOPE = []

# And for local debugging, use one of the debug middlewares and set:
FACEBOOK_DEBUG_TOKEN = ''
Expand Down Expand Up @@ -40,12 +40,12 @@ tag calls ``FB.init`` with your configured application settings. It is
best to put your facebook related javascript into the ``facebook_code``
region so that it can be called by the asynchronous handler.

You may find the ``facebook_perms`` tag useful, which takes the setting
in FACEBOOK_PERMS and prints the extended permissions out in a
You may find the ``facebook_scope`` tag useful, which takes the setting
in FACEBOOK_SCOPE and prints the extended permissions out in a
comma-separated list.

<fb:login-button show-faces="false" width="200" max-rows="1"
perms="{% facebook_perms %}"></fb:login-button>
scope="{% facebook_scope %}"></fb:login-button>


A helpful debugging page to view the status of your facebook login can
Expand Down
2 changes: 1 addition & 1 deletion django_facebook/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _view(request, *args, **kwargs):

# If the user has not authorised redirect them
if not data.get('user_id'):
scope = getattr(settings, 'FACEBOOK_PERMS', None)
scope = getattr(settings, 'FACEBOOK_SCOPE', None)
auth_url = facebook.auth_url(settings.FACEBOOK_APP_ID, settings.FACEBOOK_CANVAS_PAGE, scope)
markup = '<script type="text/javascript">top.location.href="%s"</script>' % auth_url
return HttpResponse(markup)
Expand Down
4 changes: 1 addition & 3 deletions django_facebook/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,5 @@ def process_request(self, request):
if fb_user and request.user.is_anonymous():
user = auth.authenticate(fb_uid=fb_user['uid'], fb_graphtoken=fb_user['access_token'])
if user:
user.last_login = datetime.datetime.now()
user.save()
request.user = user
auth.login(request, user)
return None
4 changes: 2 additions & 2 deletions django_facebook/templatetags/facebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ def render(self, context):
return t.render(context)

@register.simple_tag
def facebook_perms():
return ",".join(getattr(settings, 'FACEBOOK_PERMS', []))
def facebook_scope():
return ",".join(getattr(settings, 'FACEBOOK_SCOPE', []))