Rewrote the whole login system to use session keys (so it'll be easier to implement the API)