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

« back to all changes in this revision

Viewing changes to www/dispatch/login.py

  • Committer: dcoles
  • Date: 2008-02-13 04:10:55 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:443
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
            # From this point onwards, we will be showing an error message
61
61
            # if unsuccessful.
62
62
            # Authenticate
63
 
            if (password is not None and
64
 
                authenticate.authenticate(username.value, password.value)):
65
 
                # Success - Set the session and redirect to avoid POSTDATA
66
 
                session['login_name'] = username.value
67
 
                session.save()
68
 
                req.throw_redirect(req.uri)
 
63
            if password is None:
 
64
                badlogin = True
69
65
            else:
70
 
                badlogin = True
 
66
                login_details = \
 
67
                    authenticate.authenticate(username.value, password.value)
 
68
                if login_details is None:
 
69
                    badlogin = True
 
70
                else:
 
71
                    # Success - Set the session and redirect to avoid POSTDATA
 
72
                    session['login_name'] = username.value
 
73
                    session['unixid'] = login_details['unixid']
 
74
                    session['nick'] = login_details['nick']
 
75
                    session['fullname'] = login_details['fullname']
 
76
                    session['rolenm'] = login_details['rolenm']
 
77
                    session['studentid'] = login_details['studentid']
 
78
                    session.save()
 
79
                    req.throw_redirect(req.uri)
71
80
 
72
81
    # User is not logged in. Present the login box.
73
82
    # Give a 403 Forbidden status, but present a full HTML login page
79
88
 
80
89
    # Write the HTML for the login page
81
90
    # If badlogin, display an error message indicating a failed login
82
 
    req.write("""<p>Welcome to the Informatics Virtual Learning Environment.
 
91
    req.write("""<div id="ivle_padding">
 
92
<p>Welcome to the Informatics Virtual Learning Environment.
83
93
   Please log in to access your files and assessment.</p>""")
84
94
    if badlogin:
85
95
        req.write("""<p class="error">Invalid username or password.</p>""")
90
100
    <tr><td colspan="2"><input type="submit" value="Login" /></td></tr>
91
101
  </table>
92
102
</form>
 
103
</div>
93
104
""")
94
105
 
95
106
    return None