code: def post_user_login(sender, request, user, **kwargs):
      
      logger.debug("Running post-processing for user login.")
      # Users created by social login or admins have no profile.
      # We fix that during their first login.
      try:
          with transaction.atomic():
              profile, created = UserProfile.objects.get_or_create(user=user)
              if created:
                  logger.info("Created missing profile for user " + str(user.pk))
      except Exception as e:
          logger.error("Error while creating user profile: " + str(e))
      check_permission_system()
docs: Create a profile for the user, when missing.
          Make sure that all neccessary user groups exist and have the right permissions.
          We need that automatism for people not calling the configure tool,
          admin rights for admins after the first login, and similar cases.