Skip to content

Commit

Permalink
Auth: Avoid messing up with kwargs during request
Browse files Browse the repository at this point in the history
We can accept it directly by self.request now. It was not available
in older Django releases.
  • Loading branch information
nijel committed Jun 15, 2020
1 parent efc9df9 commit 37d86c2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions weblate/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ def get_context_data(self, **kwargs):
context["is_remove"] = False
# This view is not visible for invitation that's
# why don't handle user_invite here
if kwargs["password_reset"]:
if self.request.flags["password_reset"]:
context["title"] = _("Password reset")
context["is_reset"] = True
elif kwargs["account_remove"]:
elif self.request.flags["account_remove"]:
context["title"] = _("Remove account")
context["is_remove"] = True
else:
Expand All @@ -179,9 +179,12 @@ def get(self, request, *args, **kwargs):
if not request.session.get("registration-email-sent"):
return redirect("home")

kwargs["password_reset"] = request.session["password_reset"]
kwargs["account_remove"] = request.session["account_remove"]
kwargs["user_invite"] = request.session["user_invite"]
request.flags = {
"password_reset": request.session["password_reset"],
"account_remove": request.session["account_remove"],
"user_invite": request.session["user_invite"],
}

# Remove session for not authenticated user here.
# It is no longer needed and will just cause problems
# with multiple registrations from single browser.
Expand Down

0 comments on commit 37d86c2

Please sign in to comment.