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

« back to all changes in this revision

Viewing changes to ivle/dispatch/__init__.py

Don't set req.user unless the login in the session specifies a valid user.
Previously a disabled or expired user could be put in req.user.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
    # Hack? Try and get the user login early just in case we throw an error
130
130
    # (most likely 404) to stop us seeing not logged in even when we are.
131
131
    if not req.publicmode:
132
 
        req.user = login.get_user_details(req)
 
132
        user = login.get_user_details(req)
 
133
 
 
134
        # Don't set the user if it is disabled or hasn't accepted the ToS.
 
135
        if user.valid:
 
136
            req.user = user
133
137
 
134
138
    ### BEGIN New plugins framework ###
135
139
    # XXX This should be done ONCE per Python process, not per request.