Added logic for login action