Use decode method to decode the byte string instead of casting it to string and replacing the byte string syntax in the string.
This commit is contained in:
@@ -14,9 +14,7 @@ def sendEmail(request,username,secret):
|
|||||||
kwargs = {key: username}
|
kwargs = {key: username}
|
||||||
user = User.objects.get(**kwargs)
|
user = User.objects.get(**kwargs)
|
||||||
res=render(request,"mfa_email_token_template.html",{"request":request,"user":user,'otp':secret})
|
res=render(request,"mfa_email_token_template.html",{"request":request,"user":user,'otp':secret})
|
||||||
body = str(res.content).replace("b'", "")
|
return send([user.email],"OTP", res.content.decode())
|
||||||
body = body[:-1] if body.endswith("'") else body
|
|
||||||
return send([user.email],"OTP", body)
|
|
||||||
|
|
||||||
@never_cache
|
@never_cache
|
||||||
def start(request):
|
def start(request):
|
||||||
|
|||||||
Reference in New Issue
Block a user