From 3ffc3a5a9da7a856ce1018381095bacc35b32de3 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sat, 10 Sep 2022 16:46:24 +0200 Subject: [PATCH] dm: decode bytestring Thanks: Alexandre Detiste for reporting Signed-off-by: Mattia Rizzolo --- dm/tests/test_claim.py | 2 +- dm/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dm/tests/test_claim.py b/dm/tests/test_claim.py index 168bb79f..652336c4 100644 --- a/dm/tests/test_claim.py +++ b/dm/tests/test_claim.py @@ -71,7 +71,7 @@ class TestClaim(PersonFixtureMixin, TestCase): # Get and return the confirmation url from the result self.assertIn("/dm/claim/confirm", response.context["plaintext"]) - self.assertIn(b"-----BEGIN PGP MESSAGE-----", response.context["challenge"]) + self.assertIn("-----BEGIN PGP MESSAGE-----", response.context["challenge"]) return identity, response.context["plaintext"].strip() def _test_success(self, person, issuer): diff --git a/dm/views.py b/dm/views.py index 3f627804..ea13ce79 100644 --- a/dm/views.py +++ b/dm/views.py @@ -104,7 +104,7 @@ class Claim(VisitorMixin, FormView): # by unit tests without the need to have access to the private key # to decode it ctx["plaintext"] = plaintext - ctx["challenge"] = key.encrypt(plaintext.encode("utf8")) + ctx["challenge"] = key.encrypt(plaintext.encode("utf8")).decode("utf8") return ctx def form_valid(self, form): -- GitLab