login & register code rework