Updated login logic to include proper URLs for redirects and proper error messages if form is incomplete or credentials are wrong.