Repair to login code, support for CAS login.