~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-03-25 05:53:14 UTC
  • mto: (1165.3.1 submissions)
  • mto: This revision was merged to the branch mainline in revision 1174.
  • Revision ID: grantw@unimelb.edu.au-20090325055314-7em2o0dizz5rf5xe
Add database classes for assessed, project_extension and project_submission. 

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
 
                        user = authenticate.authenticate(req.config, req.store,
 
105
                        user = authenticate.authenticate(req.store,
105
106
                                    username.value, password.value)
106
107
                    except AuthError, msg:
107
108
                        badlogin = msg
127
128
                                          plugin.cookies[cookie](user), path='/'))
128
129
 
129
130
                        # Add any new enrolments.
130
 
                        ivle.pulldown_subj.enrol_user(req.config, req.store, user)
 
131
                        ivle.pulldown_subj.enrol_user(req.store, user)
131
132
                        req.store.commit()
132
133
 
133
134
                        req.throw_redirect(nexturl)
151
152
        if req.method == "POST":
152
153
            req.logout()
153
154
        else:
154
 
            ctx['path'] =  req.make_path('+logout')
 
155
            ctx['path'] =  ivle.util.make_path('+logout')