From 80bd8d2039e24732e04405d061c805d1eaa908d6 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 31 Mar 2017 11:49:25 +0200 Subject: [PATCH] Fix TypeError introduced in 9dacea11 --- src/pretix/control/views/user.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/pretix/control/views/user.py b/src/pretix/control/views/user.py index 92537c4a90..ec6a38b1a6 100644 --- a/src/pretix/control/views/user.py +++ b/src/pretix/control/views/user.py @@ -234,9 +234,10 @@ class User2FADeviceConfirmU2FView(RecentAuthenticationRequiredMixin, TemplateVie note = '' if not self.request.user.require_2fa: - note = ' ' + _('Please note that you still need to enable two-factor authentication for your account ' - 'using the buttons below to make a second factor required for logging into your accont.') - messages.success(request, _('The device has been verified and can now be used.') + note) + note = ' ' + str(_('Please note that you still need to enable two-factor authentication for your ' + 'account using the buttons below to make a second factor required for logging ' + 'into your accont.')) + messages.success(request, str(_('The device has been verified and can now be used.')) + note) return redirect(reverse('control:user.settings.2fa')) except Exception: messages.error(request, _('The registration could not be completed. Please try again.')) @@ -279,7 +280,12 @@ class User2FADeviceConfirmTOTPView(RecentAuthenticationRequiredMixin, TemplateVi _('A new two-factor authentication device has been added to your account.') ]) - messages.success(request, _('The device has been verified and can now be used.')) + note = '' + if not self.request.user.require_2fa: + note = ' ' + str(_('Please note that you still need to enable two-factor authentication for your ' + 'account using the buttons below to make a second factor required for logging ' + 'into your accont.')) + messages.success(request, str(_('The device has been verified and can now be used.')) + note) return redirect(reverse('control:user.settings.2fa')) else: messages.error(request, _('The code you entered was not valid. If this problem persists, please check '