Updated login form logic