From: Attila-Mihaly Balazs Date: Tue, 25 Mar 2014 12:35:26 +0000 (+0200) Subject: Further fixes for subfolder hosting X-Git-Tag: live~21^2 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/9b8e2e53b0f70f91868b4c16e130967c7da5a958 Further fixes for subfolder hosting --- 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,