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

« back to all changes in this revision

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

  • Committer: William Grant
  • Date: 2009-04-28 05:06:00 UTC
  • Revision ID: grantw@unimelb.edu.au-20090428050600-hogd9d6wo7ksyqy8
ivle.database.get_store() now takes a configuration object.

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
28
29
import ivle.pulldown_subj
29
30
import ivle.webapp.security
30
31
from ivle.auth import authenticate, AuthError
61
62
        else:
62
63
            query_string = '?url=' + urllib.quote(nexturl, safe="/~")
63
64
 
64
 
        ctx['path'] = req.make_path('+login') + query_string
 
65
        ctx['path'] = ivle.util.make_path('+login') + query_string
65
66
 
66
67
        # If this succeeds, the user is invalid.
67
68
        user = ivle.webapp.security.get_user_details(req)
72
73
                # if you are not planning to display a ToS page - the ToS
73
74
                # acceptance process actually calls usrmgt to create the user
74
75
                # jails and related stuff.
75
 
                req.throw_redirect(req.make_path('+tos') + query_string)
 
76
                req.throw_redirect(ivle.util.make_path('+tos') + query_string)
76
77
            elif user.state == "pending":
77
78
                # FIXME: this isn't quite the right answer, but it
78
79
                # should be more robust in the short term.
101
102
                else:
102
103
                    user = None
103
104
                    try:
104
 
                        # Username is case insensitive
105
 
                        user = authenticate.authenticate(req.config, req.store,
106
 
                                    username.value.lower(), password.value)
 
105
                        user = authenticate.authenticate(req.store,
 
106
                                    username.value, 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.config, req.store, user)
 
131
                        ivle.pulldown_subj.enrol_user(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'] =  req.make_path('+logout')
 
155
            ctx['path'] =  ivle.util.make_path('+logout')