Added a null check on login to prevent ajax call from crashing app on null response from database