Updated login with proper validation