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

« back to all changes in this revision

Viewing changes to ivle/webapp/base/xhtml.py

Move the login machinery to the new framework.

The login page is now redirected to by the XHTML Unauthorized page, and knows
to return to the right URL when authentication succeeds. It also means that we
no longer return a 200 with login page content for a totally unrelated page...

Some of the user stuff (disabling, Tos, etc.) is now broken, and /logout moved
to /+logout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import inspect
21
21
import os.path
 
22
import urllib
22
23
 
23
24
import genshi.template
24
25
 
177
178
 
178
179
    def __init__(self, req, exception):
179
180
        super(XHTMLUnauthorizedView, self).__init__(req, exception)
 
181
 
 
182
        # TODO: ToS, disabled, pending
180
183
        if req.user is None:
181
184
            # Not logged in. Redirect to login page.
182
 
            req.throw_redirect('/') # XXX: Need proper URL.
 
185
            req.throw_redirect('/+login?' + 
 
186
                               urllib.urlencode([('url', req.uri)]))
183
187
 
184
188
        req.status = 403