~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/security/views.py

Don't escape / in paths when they are in +login/+tos URLs.

Also don't put it in the URL at all if it is /.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        if req.user is not None:
53
53
            req.throw_redirect(nexturl)
54
54
 
55
 
        ctx['path'] = ivle.util.make_path('+login') + \
56
 
                         '?' + urllib.urlencode([('url', nexturl)])
 
55
        # Don't give any URL if we want /.
 
56
        if nexturl == '/':
 
57
            query_string = ''
 
58
        else:
 
59
            query_string = '?url=' + urllib.quote(nexturl, safe="/~")
 
60
 
 
61
        ctx['path'] = ivle.util.make_path('+login') + query_string
57
62
 
58
63
        # If this succeeds, the user is invalid.
59
64
        user = ivle.webapp.security.get_user_details(req)
64
69
                # if you are not planning to display a ToS page - the ToS
65
70
                # acceptance process actually calls usrmgt to create the user
66
71
                # jails and related stuff.
67
 
                req.throw_redirect(ivle.util.make_path('+tos') + \
68
 
                        '?' + urllib.urlencode([('url', nexturl)]))
 
72
                req.throw_redirect(ivle.util.make_path('+tos') + query_string)
69
73
            elif user.state == "pending":
70
74
                # FIXME: this isn't quite the right answer, but it
71
75
                # should be more robust in the short term.