Improved code generation for code login