Skip to content

Commit

Permalink
Fix Draugiem redirect URL generation
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed Feb 26, 2017
1 parent 360e695 commit 3454d26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 2 additions & 3 deletions allauth/socialaccount/providers/draugiem/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ def mock_socialaccount_state(self):
session.save()

def test_login_redirect(self):
response = self.client.get(reverse(views.login),
follow=False, **{'HTTP_HOST': 'localhost'})
redirect_url = 'http://localhost' + reverse(views.callback)
response = self.client.get(reverse(views.login))
redirect_url = 'http://testserver' + reverse(views.callback)
redirect_url_hash = md5(
(self.app.secret + redirect_url).encode('utf-8')).hexdigest()
params = {
Expand Down
5 changes: 1 addition & 4 deletions allauth/socialaccount/providers/draugiem/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ class DraugiemApiError(Exception):
def login(request):
app = providers.registry.by_id(
DraugiemProvider.id, request).get_app(request)
request_scheme = request.META['wsgi.url_scheme']
request_host = request.META['HTTP_HOST']
request_path = reverse(callback)
redirect_url = '%s://%s%s' % (request_scheme, request_host, request_path)
redirect_url = request.build_absolute_uri(reverse(callback))
redirect_url_hash = md5((
app.secret + redirect_url).encode('utf-8')).hexdigest()
params = {
Expand Down

0 comments on commit 3454d26

Please sign in to comment.