Added login functionality I think.

But most of the database has mysteriously disappeared so I can't test
it.