Changed the login functionality code to use angulars factory pattern still need to add additional redirects