From 9b8e2e53b0f70f91868b4c16e130967c7da5a958 Mon Sep 17 00:00:00 2001 From: Attila-Mihaly Balazs Date: Tue, 25 Mar 2014 14:35:26 +0200 Subject: [PATCH] Further fixes for subfolder hosting --- forum/views/auth.py | 2 +- forum/views/writers.py | 4 ++-- forum_modules/facebookauth/authentication.py | 4 +++- forum_modules/oauthauth/consumer.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/forum/views/auth.py b/forum/views/auth.py index 01f6210..00b67dc 100644 --- a/forum/views/auth.py +++ b/forum/views/auth.py @@ -89,7 +89,7 @@ def prepare_provider_signin(request, provider): try: request_url = provider_class.prepare_authentication_request(request, - reverse('auth_provider_done', + reverse('auth_provider_done', prefix='/', kwargs={'provider': provider})) return HttpResponseRedirect(request_url) diff --git a/forum/views/writers.py b/forum/views/writers.py index 304032c..597ddba 100644 --- a/forum/views/writers.py +++ b/forum/views/writers.py @@ -98,7 +98,7 @@ def ask(request): if request.user.is_authenticated(): messages.info(request, _("Your question is pending until you %s.") % html.hyperlink( - reverse('send_validation_email'), _("validate your email") + django_settings.APP_URL + reverse('send_validation_email', prefix='/'), _("validate your email") )) return HttpResponseRedirect(reverse('index')) else: @@ -273,7 +273,7 @@ def answer(request, id): if request.user.is_authenticated(): messages.info(request, _("Your answer is pending until you %s.") % html.hyperlink( - reverse('send_validation_email'), _("validate your email") + django_settings.APP_URL + reverse('send_validation_email', prefix='/'), _("validate your email") )) return HttpResponseRedirect(question.get_absolute_url()) else: diff --git a/forum_modules/facebookauth/authentication.py b/forum_modules/facebookauth/authentication.py index b80c477..c98eaf1 100644 --- a/forum_modules/facebookauth/authentication.py +++ b/forum_modules/facebookauth/authentication.py @@ -8,6 +8,7 @@ from forum.authentication.base import AuthenticationConsumer, ConsumerTemplateCo from django.conf import settings as django_settings from django.utils.encoding import smart_unicode +from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ import settings @@ -30,7 +31,8 @@ class FacebookAuthConsumer(AuthenticationConsumer): def process_authentication_request(self, request): try: - args = dict(client_id=settings.FB_API_KEY, redirect_uri="%s%s" % (django_settings.APP_URL, request.path)) + redirect_uri = "%s%s" % (django_settings.APP_URL, reverse('auth_provider_done', prefix='/', kwargs={'provider': 'facebook'})) + args = dict(client_id=settings.FB_API_KEY, redirect_uri=redirect_uri) args["client_secret"] = settings.FB_APP_SECRET #facebook APP Secret diff --git a/forum_modules/oauthauth/consumer.py b/forum_modules/oauthauth/consumer.py index bbbaac8..ee9bf97 100644 --- a/forum_modules/oauthauth/consumer.py +++ b/forum_modules/oauthauth/consumer.py @@ -52,7 +52,7 @@ class OAuthAbstractAuthConsumer(AuthenticationConsumer): parameters = {} # If the installation is configured to automatically redirect to the Twitter provider done page -- do it. if bool(TWITTER_AUTO_CALLBACK_REDIRECT): - callback_url = '%s%s' % (APP_URL, reverse('auth_provider_done', kwargs={ 'provider' : 'twitter', })) + callback_url = '%s%s' % (APP_URL, reverse('auth_provider_done', prefix='/', kwargs={'provider' : 'twitter'})) # Pass parameters.update({ 'oauth_callback' : callback_url, -- 2.39.5