code format
moved authentication inside the controller and added an html login form