Skip to content

Commit

Permalink
WordPress encode whitespaces using "+", so we need to use unquote_plu…
Browse files Browse the repository at this point in the history
…s to correctly parse the authentication cookie
  • Loading branch information
rafaelcanovas committed Feb 2, 2015
1 parent 9e9f367 commit b135922
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='django-wordpress-auth',
version='0.1.0',
version='0.1.1',
description='Django integration with WordPress authentication and roles / capabilities system.',
long_description=open('README.rst').read(),
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion wordpress_auth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.1.0'
__version__ = '0.1.1'

from django.conf import settings

Expand Down
8 changes: 2 additions & 6 deletions wordpress_auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
import hashlib
from time import time

try:
from urllib.parse import urljoin, unquote
except ImportError:
from urlparse import urljoin # Python 2
from urllib2 import unquote
from django.utils.six.moves.urllib.parse import urljoin, unquote_plus

from wordpress_auth import WORDPRESS_LOGGED_IN_KEY, WORDPRESS_LOGGED_IN_SALT
from wordpress_auth.models import WpOptions, WpUsers
Expand All @@ -28,7 +24,7 @@ def get_wordpress_user(request):
cookie = request.COOKIES.get('wordpress_logged_in_' + cookie_hash)

if cookie:
cookie = unquote(cookie)
cookie = unquote_plus(cookie)
return _validate_auth_cookie(cookie)


Expand Down

0 comments on commit b135922

Please sign in to comment.