Add logger + improve the way we build password reset url

This commit is contained in:
PCoder 2019-05-01 20:39:25 +02:00
parent d0faf78168
commit 3a88a98b95

View file

@ -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