Optimized login method