Corrected result handling and flash messages generation during login action.