Added login and logout views/links

I'll merge this to master in the morning after I review it when I am not
as tired
Fixed syntax errors in the mailer files.
Added user unit tests.