add router and refactor login