Fix SQL query in login action