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

« back to all changes in this revision

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

  • Committer: David Coles
  • Date: 2009-12-10 01:18:36 UTC
  • Revision ID: coles.david@gmail.com-20091210011836-6kk2omcmr9hvphj0
Correct documentation's system diagram (console communication goes via Application Slaves)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    # This needs to be importable from outside Apache.
26
26
    pass
27
27
 
28
 
import ivle.util
29
28
import ivle.pulldown_subj
30
29
import ivle.webapp.security
31
30
from ivle.auth import authenticate, AuthError
62
61
        else:
63
62
            query_string = '?url=' + urllib.quote(nexturl, safe="/~")
64
63
 
65
 
        ctx['path'] = ivle.util.make_path('+login') + query_string
 
64
        ctx['path'] = req.make_path('+login') + query_string
66
65
 
67
66
        # If this succeeds, the user is invalid.
68
67
        user = ivle.webapp.security.get_user_details(req)
73
72
                # if you are not planning to display a ToS page - the ToS
74
73
                # acceptance process actually calls usrmgt to create the user
75
74
                # jails and related stuff.
76
 
                req.throw_redirect(ivle.util.make_path('+tos') + query_string)
 
75
                req.throw_redirect(req.make_path('+tos') + query_string)
77
76
            elif user.state == "pending":
78
77
                # FIXME: this isn't quite the right answer, but it
79
78
                # should be more robust in the short term.
102
101
                else:
103
102
                    user = None
104
103
                    try:
105
 
                        user = authenticate.authenticate(req.store,
106
 
                                    username.value, password.value)
 
104
                        # Username is case insensitive
 
105
                        user = authenticate.authenticate(req.config, req.store,
 
106
                                    username.value.lower(), password.value)
107
107
                    except AuthError, msg:
108
108
                        badlogin = msg
109
109
                    if user is None:
128
128
                                          plugin.cookies[cookie](user), path='/'))
129
129
 
130
130
                        # Add any new enrolments.
131
 
                        ivle.pulldown_subj.enrol_user(req.store, user)
 
131
                        ivle.pulldown_subj.enrol_user(req.config, req.store, user)
132
132
                        req.store.commit()
133
133
 
134
134
                        req.throw_redirect(nexturl)
152
152
        if req.method == "POST":
153
153
            req.logout()
154
154
        else:
155
 
            ctx['path'] =  ivle.util.make_path('+logout')
 
155
            ctx['path'] =  req.make_path('+logout')