Commited some earlier changes to users.sql (not committed earlier due to misunderstanding :|) Previous changes today actually depended on the database being updated with this schema.
users.sql: Added "pending" option to login.state, and added a bunch of new fields to login: expiry timers, time of last login.
login.py: Checks if account has expired. Sets last login. (Currently buggy with some XXXs, because we don't have a way to convert Python time values into SQL).
db.py: Added last_login to list of allowable fields for login.