code: def files_auth(request):
      
      if "password" in request.POST:
          """
              Encrypt the password with AES mode CFB.
              Create a random 32 char key, stored in a CLIENT-side cookie.
              Create a random 32 char IV, stored in a SERVER-side session.
              Store the encrypted ciphertext in a SERVER-side session.
  
              This ensures that neither side can decrypt the password without
              the information stored on the other end of the request.
  
              Both the server-side session variables and the client-side cookies
              are deleted when the user logs out.
          """
          key = Random.new().read(32)
          iv = Random.new().read(16)
          obj = AES.new(key, AES.MODE_CFB, iv)
          message = request.POST.get("password")
          if isinstance(message, str):
              message = message.encode("utf-8")
          ciphertext = obj.encrypt(message)
          request.session["files_iv"] = base64.b64encode(iv).decode()
          request.session["files_text"] = base64.b64encode(ciphertext).decode()
          cookie_key = base64.b64encode(key).decode()
  
          nexturl = request.GET.get("next", None)
          if nexturl and nexturl.startswith("/files"):
              response = redirect(nexturl)
          else:
              response = redirect("files")
          response.set_cookie(key="files_key", value=cookie_key)
          if "username" in request.POST:
              request.session["filecenter_username"] = request.POST.get("username")
          return response
      else:
          return render(request, "files/auth.html", {"is_admin": request.user.member_of("admin_all")})
docs: Display authentication for filecenter.