AS refactor login js