added session checking to controllers and login error handling to js