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

« back to all changes in this revision

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

Move ivle.dispatch.login.get_user_details() to ivle.webapp.security.

That empties ivle.dispatch.login, so it dies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    pass
27
27
 
28
28
import ivle.util
29
 
import ivle.dispatch.login
 
29
import ivle.webapp.security
30
30
from ivle.auth import authenticate, AuthError
31
31
from ivle.webapp.base.xhtml import XHTMLView
32
32
from ivle.webapp.base.plugins import CookiePlugin
33
 
from ivle.dispatch.login import get_user_details
34
33
 
35
34
class LoginView(XHTMLView):
36
35
    '''A view to allow a user to log in.'''
57
56
                         '?' + urllib.urlencode([('url', nexturl)])
58
57
 
59
58
        # If this succeeds, the user is invalid.
60
 
        user = get_user_details(req)
 
59
        user = ivle.webapp.security.get_user_details(req)
61
60
        if user is not None:
62
61
            if user.state == "no_agreement":
63
62
                # Authenticated, but need to accept the ToS. Send them there.
80
79
        if req.method == "POST":
81
80
            # While req.user is normally set to get_user_details, it won't set
82
81
            # it if the account isn't valid. So we get it ourselves.
83
 
            user = get_user_details(req)
 
82
            user = ivle.webapp.security.get_user_details(req)
84
83
 
85
84
            badlogin = None
86
85
 
135
134
    def authorize(self, req):
136
135
        # This can be used by any authenticated user, even if they haven't
137
136
        # accepted the ToS yet.
138
 
        return ivle.dispatch.login.get_user_details(req) is not None
 
137
        return ivle.webapp.security.get_user_details(req) is not None
139
138
 
140
139
    def populate(self, req, ctx):
141
140
        if req.method == "POST":