Fixed ?next=<url> argument for require_active_login
It now includes the full URI, including GET args, not just the path.
This commit is contained in:
parent
30520c92cc
commit
3a1993288f
@ -16,6 +16,9 @@
|
||||
|
||||
from functools import wraps
|
||||
|
||||
from urlparse import urljoin
|
||||
from urllib import urlencode
|
||||
|
||||
from webob import exc
|
||||
|
||||
from mediagoblin.db.util import ObjectId, InvalidId
|
||||
@ -34,10 +37,16 @@ def require_active_login(controller):
|
||||
request, 'mediagoblin.user_pages.user_home',
|
||||
user=request.user.username)
|
||||
elif not request.user or request.user.get('status') != u'active':
|
||||
next_url = urljoin(
|
||||
request.urlgen('mediagoblin.auth.login',
|
||||
qualified=True),
|
||||
request.url)
|
||||
|
||||
return exc.HTTPFound(
|
||||
location="%s?next=%s" % (
|
||||
request.urlgen("mediagoblin.auth.login"),
|
||||
request.full_path))
|
||||
location='?'.join([
|
||||
request.urlgen('mediagoblin.auth.login'),
|
||||
urlencode({
|
||||
'next': next_url})]))
|
||||
|
||||
return controller(request, *args, **kwargs)
|
||||
|
||||
|
@ -25,12 +25,13 @@ _log = logging.getLogger(__name__)
|
||||
|
||||
PLUGIN_DIR = os.path.dirname(__file__)
|
||||
|
||||
config = pluginapi.get_config(__name__)
|
||||
|
||||
def setup_plugin():
|
||||
config = pluginapi.get_config(__name__)
|
||||
|
||||
_log.info('Setting up API...')
|
||||
|
||||
_log.debug('API config: {0}'.format(config))
|
||||
|
||||
routes = [
|
||||
Route('mediagoblin.plugins.api.test', '/api/test',
|
||||
controller='mediagoblin.plugins.api.views:api_test'),
|
||||
|
@ -33,6 +33,8 @@ from mediagoblin.media_types import sniff_media, InvalidFileType, \
|
||||
from mediagoblin.plugins.api.tools import api_auth, get_entry_serializable, \
|
||||
json_response
|
||||
|
||||
from mediagoblin.plugins.api import config
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user