refactor login action