From c34efd6ba94145db1629f9fe422ba54d91d4f69f Mon Sep 17 00:00:00 2001 From: nswain Date: Wed, 9 Sep 2020 09:04:44 -0600 Subject: [PATCH] Use decode method to decode the byte string instead of casting it to string and replacing the byte string syntax in the string. --- mfa/Email.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mfa/Email.py b/mfa/Email.py index 37ccdc8..a2c3119 100644 --- a/mfa/Email.py +++ b/mfa/Email.py @@ -14,9 +14,7 @@ def sendEmail(request,username,secret): kwargs = {key: username} user = User.objects.get(**kwargs) res=render(request,"mfa_email_token_template.html",{"request":request,"user":user,'otp':secret}) - body = str(res.content).replace("b'", "") - body = body[:-1] if body.endswith("'") else body - return send([user.email],"OTP", body) + return send([user.email],"OTP", res.content.decode()) @never_cache def start(request):