Login logic corrected