factors/otp(minor): fix old URLs

This commit is contained in:
Jens Langhammer 2019-10-07 21:23:25 +02:00
parent 245ec65cbb
commit a390bb7b59
3 changed files with 9 additions and 9 deletions

View File

@ -16,7 +16,7 @@ class OTPFactor(Factor):
form = 'passbook.factors.otp.forms.OTPFactorForm' form = 'passbook.factors.otp.forms.OTPFactorForm'
def has_user_settings(self): def has_user_settings(self):
return _('OTP'), 'pficon-locked', 'passbook_otp:otp-user-settings' return _('OTP'), 'pficon-locked', 'passbook_factors_otp:otp-user-settings'
def __str__(self): def __str__(self):
return f"OTP Factor {self.slug}" return f"OTP Factor {self.slug}"

View File

@ -26,10 +26,10 @@
</p> </p>
<p> <p>
{% if not state %} {% if not state %}
<a href="{% url 'passbook_otp:otp-enable' %}" <a href="{% url 'passbook_factors_otp:otp-enable' %}"
class="btn btn-success btn-sm">{% trans "Enable OTP" %}</a> class="btn btn-success btn-sm">{% trans "Enable OTP" %}</a>
{% else %} {% else %}
<a href="{% url 'passbook_otp:otp-disable' %}" <a href="{% url 'passbook_factors_otp:otp-disable' %}"
class="btn btn-danger btn-sm">{% trans "Disable OTP" %}</a> class="btn btn-danger btn-sm">{% trans "Disable OTP" %}</a>
{% endif %} {% endif %}
</p> </p>

View File

@ -21,8 +21,8 @@ from passbook.factors.otp.utils import otpauth_url
from passbook.lib.boilerplate import NeverCacheMixin from passbook.lib.boilerplate import NeverCacheMixin
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
OTP_SESSION_KEY = 'passbook_otp_key' OTP_SESSION_KEY = 'passbook_factors_otp_key'
OTP_SETTING_UP_KEY = 'passbook_otp_setup' OTP_SETTING_UP_KEY = 'passbook_factors_otp_setup'
LOGGER = get_logger() LOGGER = get_logger()
class UserSettingsView(LoginRequiredMixin, TemplateView): class UserSettingsView(LoginRequiredMixin, TemplateView):
@ -61,7 +61,7 @@ class DisableView(LoginRequiredMixin, View):
# current=True, # current=True,
# request=request, # request=request,
# send_notification=True) # send_notification=True)
return redirect(reverse('passbook_otp:otp-user-settings')) return redirect(reverse('passbook_factors_otp:otp-user-settings'))
class EnableView(LoginRequiredMixin, FormView): class EnableView(LoginRequiredMixin, FormView):
"""View to set up OTP""" """View to set up OTP"""
@ -88,7 +88,7 @@ class EnableView(LoginRequiredMixin, FormView):
if finished_totp_devices.exists() and finished_static_devices.exists(): if finished_totp_devices.exists() and finished_static_devices.exists():
messages.error(request, _('You already have TOTP enabled!')) messages.error(request, _('You already have TOTP enabled!'))
del request.session[OTP_SETTING_UP_KEY] del request.session[OTP_SETTING_UP_KEY]
return redirect('passbook_otp:otp-user-settings') return redirect('passbook_factors_otp:otp-user-settings')
request.session[OTP_SETTING_UP_KEY] = True request.session[OTP_SETTING_UP_KEY] = True
# Check if there's an unconfirmed device left to set up # Check if there's an unconfirmed device left to set up
totp_devices = TOTPDevice.objects.filter(user=request.user, confirmed=False) totp_devices = TOTPDevice.objects.filter(user=request.user, confirmed=False)
@ -121,7 +121,7 @@ class EnableView(LoginRequiredMixin, FormView):
def get_form(self, form_class=None): def get_form(self, form_class=None):
form = super().get_form(form_class=form_class) form = super().get_form(form_class=form_class)
form.device = self.totp_device form.device = self.totp_device
form.fields['qr_code'].initial = reverse('passbook_otp:otp-qr') form.fields['qr_code'].initial = reverse('passbook_factors_otp:otp-qr')
tokens = [(x.token, x.token) for x in self.static_device.token_set.all()] tokens = [(x.token, x.token) for x in self.static_device.token_set.all()]
form.fields['tokens'].choices = tokens form.fields['tokens'].choices = tokens
return form return form
@ -142,7 +142,7 @@ class EnableView(LoginRequiredMixin, FormView):
# current=True, # current=True,
# request=self.request, # request=self.request,
# send_notification=True) # send_notification=True)
return redirect('passbook_otp:otp-user-settings') return redirect('passbook_factors_otp:otp-user-settings')
class QRView(NeverCacheMixin, View): class QRView(NeverCacheMixin, View):
"""View returns an SVG image with the OTP token information""" """View returns an SVG image with the OTP token information"""