Fixed recursive loop problem with logout
Updated login function and redirection