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

« back to all changes in this revision

Viewing changes to www/dispatch/login.py

  • Committer: mattgiuca
  • Date: 2008-02-29 01:18:22 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:621
Added 2 new apps: home and subjects. Both fairly incomplete, just a basic
    skeleton.
    "home" is the new default app, replacing "files".
    (It has a link to files).

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
from mod_python import Session
27
27
 
28
 
import conf
29
28
from common import (util, db, caps, forumutil)
30
29
from auth import authenticate, autherror
31
30
 
85
84
                    badlogin = "Your account has expired."
86
85
                else:
87
86
                    # Success - Set the session and redirect to avoid POSTDATA
 
87
                    # TODO: Store the User object in session instead of
 
88
                    # individual fields
88
89
                    session = req.get_session()
89
90
                    session['user'] = login_details
90
91
                    session.save()
91
 
                    db.DB().update_user(username.value,
92
 
                                        last_login = time.localtime())
 
92
                    # XXX time.localtime() (a tuple of ints) is not valid for
 
93
                    # inserting as a TIMESTAMP in the DB.
 
94
                    #db.DB().update_user(username.value,
 
95
                    #                    last_login=time.localtime())
93
96
                    req.add_cookie(forumutil.make_forum_cookie(login_details))
94
97
                    req.throw_redirect(req.uri)
95
98
 
96
 
    # Present the HTML login page
 
99
    # Give a 403 Forbidden status, but present a full HTML login page
 
100
    # instead of the usual 403 error.
 
101
    req.status = req.HTTP_FORBIDDEN
97
102
    req.content_type = "text/html"
98
103
    req.title = "Login"
99
104
    req.write_html_head_foot = True
141
146
    <tr><td colspan="2"><input type="submit" value="Login" /></td></tr>
142
147
  </table>
143
148
</form>
 
149
</div>
144
150
""")
145
 
    # Write the "Message of the Day" document, if it exists.
146
 
    try:
147
 
        req.sendfile(conf.motd_path)
148
 
    except IOError:
149
 
        pass
150
 
    req.write('</div>\n')
151
151
 
152
152
    return None
153
153
 
187
187
<hr />
188
188
""" % fullname)
189
189
    # Write out the text of the license
190
 
    util.send_terms_of_service(req)
 
190
    license_file = os.path.join(util.make_local_path("apps"),
 
191
                        "tos", "license.html")
 
192
    req.sendfile(license_file)
191
193
    req.write("""<hr />
192
194
<div id="tos_acceptbuttons">
193
195
<p>Please click "I Accept" to indicate that you have read and understand these