copy login code from UI builder