From 3a88a98b95a381138eb6649922beb82e4aafc44d Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 1 May 2019 20:39:25 +0200 Subject: [PATCH] Add logger + improve the way we build password reset url --- dal/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dal/views.py b/dal/views.py index 893997b..a2442cc 100644 --- a/dal/views.py +++ b/dal/views.py @@ -15,6 +15,10 @@ from .models import ResetToken from .forms import LoginForm from .ungleich_ldap import LdapManager +import logging + +logger = logging.getLogger(__name__) + # Imports for the extra stuff not in django from base64 import b64encode, b64decode @@ -277,7 +281,10 @@ class ResetPassword(View): newdbentry = ResetToken(user=user, token=token, creation=epochutc) newdbentry.save() # set up the link - link = (base_url + '/reset/%s/%s/') % (userpart.decode('utf-8'), token) + link = "{base_url}/reset/{user}/{token}/".format( + base_url=base_url,user=userpart.decode('utf-8'),token=token + ) + logger.debug("User reset url is {}".format(link)) return link