cleaned up login and registration

I moved all login and register functions to a user class and rewrote
most of it.