code: def login(request):
      '''
      Logs in the user via given login and password.
      '''
      serializer_class = registration_settings.LOGIN_SERIALIZER_CLASS
      serializer = serializer_class(data=request.data)
      serializer.is_valid(raise_exception=True)
      user = serializer.get_authenticated_user()
  
      if not user:
          raise BadRequest('Login or password invalid.')
  
      extra_data = perform_login(request, user)
  
      return get_ok_response('Login successful', extra_data=extra_dataf login(request):
      '''
      Logs in the user via given login and password.
      '''
      serializer_class = registration_settings.LOGIN_SERIALIZER_CLASS
      serializer = serializer_class(data=request.data)
      serializer.is_valid(raise_exception=True)
      user = serializer.get_authenticated_user()
  
      if not user:
          raise BadRequest('Login or password invalid.')
  
      extra_data = perform_login(request, user)
  
      return get_ok_response('Login successful', extra_data=extra_data)
docs: Logs in the user via given login and password.