Implemented login to redirect to template if successful login