Skip to content

Commit

Permalink
Fixed some deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
felixoi committed Dec 30, 2023
1 parent a4290f6 commit 770f5b0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions spongeauth/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def change_email(request):
if request.method == "POST" and form.is_valid():
new_email = form.cleaned_data["new_email"]
_send_change_email(request, request.user, new_email)
signer = Signer("accounts.views.change-email")
signer = Signer(key="accounts.views.change-email")
email_signed = urlsafe_base64_encode(signer.sign(new_email).encode("utf8"))
return redirect(reverse("accounts:change-email-sent") + "?e=" + email_signed)

Expand All @@ -361,7 +361,7 @@ def change_email(request):
@middleware.allow_without_verified_email
@login_required
def change_email_step1done(request):
signer = Signer("accounts.views.change-email")
signer = Signer(key="accounts.views.change-email")
email_signed = urlsafe_base64_decode(request.GET.get("e", ""))
try:
email = signer.unsign(email_signed.decode("utf8"))
Expand Down Expand Up @@ -467,7 +467,7 @@ def forgot(request):
user = None
if user:
_send_forgot_email(request, user)
signer = Signer("accounts.views.forgot-email")
signer = Signer(key="accounts.views.forgot-email")
email_signed = urlsafe_base64_encode(signer.sign(user.email).encode("utf8"))
return redirect(reverse("accounts:forgot-sent") + "?e=" + email_signed)
return render(request, "accounts/forgot/step1.html", {"form": form})
Expand All @@ -477,7 +477,7 @@ def forgot_step1done(request):
if request.user.is_authenticated:
return redirect(_login_redirect_url(request))

signer = Signer("accounts.views.forgot-email")
signer = Signer(key="accounts.views.forgot-email")
email_signed = urlsafe_base64_decode(request.GET.get("e", ""))
try:
email = signer.unsign(email_signed.decode("utf8"))
Expand Down
2 changes: 1 addition & 1 deletion spongeauth/sso/tests/test_discourse_sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class SignerTestCase:
def setup(self):
def setup_method(self):
self.signer = discourse_sso.DiscourseSigner(HARDCODED_SIGNING)


Expand Down
2 changes: 1 addition & 1 deletion spongeauth/sso/tests/test_make_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_cast_bool():

@pytest.mark.django_db
class TestMakePayload:
def setup(self):
def setup_method(self):
self.request = unittest.mock.MagicMock()
self.request.build_absolute_uri.return_value = "http://www.example.com/example.jpg"

Expand Down
2 changes: 1 addition & 1 deletion spongeauth/twofa/tests/test_view_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_generates_new_paper_device(self):

@pytest.mark.django_db
class TestGetVerifyDevice:
def setup(self):
def setup_method(self):
self.user = accounts.models.User.objects.create_user(
username="fred", email="fred@example.com", password="secret", twofa_enabled=True
)
Expand Down

0 comments on commit 770f5b0

Please sign in to comment.