Implement basic authentication logic.
Add basic error handling.

Will be rebuilt using formhandler.