Skip to content

Commit

Permalink
change refresh to edit 2fa
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlyskepticalpotat committed Jul 11, 2023
1 parent 3f5212f commit adc44a5
Show file tree
Hide file tree
Showing 27 changed files with 80 additions and 80 deletions.
2 changes: 1 addition & 1 deletion dmoj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

path('2fa/', two_factor.TwoFactorLoginView.as_view(), name='login_2fa'),
path('2fa/enable/', two_factor.TOTPEnableView.as_view(), name='enable_2fa'),
path('2fa/refresh/', two_factor.TOTPRefreshView.as_view(), name='refresh_2fa'),
path('2fa/edit/', two_factor.TOTPEditView.as_view(), name='edit_2fa'),
path('2fa/disable/', two_factor.TOTPDisableView.as_view(), name='disable_2fa'),
path('2fa/webauthn/attest/', two_factor.WebAuthnAttestationView.as_view(), name='webauthn_attest'),
path('2fa/webauthn/assert/', two_factor.WebAuthnAttestView.as_view(), name='webauthn_assert'),
Expand Down
12 changes: 6 additions & 6 deletions judge/views/two_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TOTPEnableView(TOTPView):
title = gettext_lazy('Enable Two-factor Authentication')
form_class = TOTPEnableForm
template_name = 'registration/totp_enable.html'
is_refresh = False
is_edit = False

def get(self, request, *args, **kwargs):
profile = self.profile
Expand All @@ -76,9 +76,9 @@ def post(self, request, *args, **kwargs):
def get_context_data(self, **kwargs):
context = super(TOTPEnableView, self).get_context_data(**kwargs)
context['totp_key'] = self.request.session['totp_enable_key']
context['scratch_codes'] = [] if self.is_refresh else json.loads(self.profile.scratch_codes)
context['scratch_codes'] = [] if self.is_edit else json.loads(self.profile.scratch_codes)
context['qr_code'] = self.render_qr_code(self.request.user.username, context['totp_key'])
context['is_refresh'] = self.is_refresh
context['is_edit'] = self.is_edit
context['is_hardcore'] = settings.DMOJ_2FA_HARDCORE
return context

Expand Down Expand Up @@ -106,9 +106,9 @@ def render_qr_code(cls, username, key):
return 'data:image/png;base64,' + base64.b64encode(buf.getvalue()).decode('ascii')


class TOTPRefreshView(TOTPEnableView):
title = gettext_lazy('Refresh Two-factor Authentication')
is_refresh = True
class TOTPEditView(TOTPEnableView):
title = gettext_lazy('Edit Two-factor Authentication')
is_edit = True

def check_skip(self):
return not self.profile.is_totp_enabled
Expand Down
6 changes: 3 additions & 3 deletions locale/ar/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3691,7 +3691,7 @@ msgid "Enable Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5495,7 +5495,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -6006,7 +6006,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr ""

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
8 changes: 4 additions & 4 deletions locale/ca/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ msgid "Enable Two-factor Authentication"
msgstr "Activar Autenticació en Dos Passos"

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5343,7 +5343,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr "Entra el codi de 6 dígits generat per la teva app:"

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5508,7 +5508,7 @@ msgid "Total:"
msgstr "Total:"

#: templates/submission/list.html:350
msgid "You were disconnected. Refresh to show latest updates."
msgid "You were disconnected. Edit to show latest updates."
msgstr "Has estat desconnectat. Actualitza la pàgina per mostrar les últimes actualitzacions."

#: templates/submission/row.html:44
Expand Down Expand Up @@ -5850,7 +5850,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr "S'ha activat l'autenticació de dos passos:"

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ msgid "Enable Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5343,7 +5343,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5850,7 +5850,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr ""

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/el/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ msgid "Enable Two-factor Authentication"
msgstr "Ενεργοποίηση Ταυτοποίησης Δύο Παραγόντων"

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr "Ανανέωση Ταυτοποίησης Δύο Παραγόντων"

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5343,7 +5343,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr "Εισάγετε τον 6-ψήφιο κωδικό που παράχθηκε από την εφαρμογή σας:"

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr "Ανανέωση Ταυτοποίησης Δύο Παραγόντων"

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5850,7 +5850,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr "Η ταυτοποίηση δύο παραγόντων είναι ενεργοποιημένη:"

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr "Ανανέωση"

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3668,7 +3668,7 @@ msgid "Enable Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5487,7 +5487,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -6015,7 +6015,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr ""

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ msgid "Enable Two-factor Authentication"
msgstr "Habilitar Autenticación en Dos Pasos"

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5343,7 +5343,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr "Entra el código de 6 dígitos generado por tu app:"

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5850,7 +5850,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr "Autenticación en dos pasos habilitada:"

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ msgid "Enable Two-factor Authentication"
msgstr "Activer l'Authentification à Deux Facteurs"

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr "Réactiver l'Authentification à Deux Facteurs"

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5343,7 +5343,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr "Saisissez le code à 6 chiffres généré par votre application :"

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr "Réactiver l'Authentification à Deux Facteurs"

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5850,7 +5850,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr "L'authentification à deux facteurs est activée :"

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr "Réactiver"

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/hr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3616,7 +3616,7 @@ msgid "Enable Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5381,7 +5381,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5889,7 +5889,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr ""

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/hu/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ msgid "Enable Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5343,7 +5343,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5850,7 +5850,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr ""

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/it/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ msgid "Enable Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5343,7 +5343,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5850,7 +5850,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr ""

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/ja/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3566,7 +3566,7 @@ msgid "Enable Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5305,7 +5305,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5811,7 +5811,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr ""

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr ""

#: templates/user/edit-profile.html:363
Expand Down
6 changes: 3 additions & 3 deletions locale/ko/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3566,7 +3566,7 @@ msgid "Enable Two-factor Authentication"
msgstr "이중 인증 활성화"

#: judge/views/two_factor.py:109
msgid "Refresh Two-factor Authentication"
msgid "Edit Two-factor Authentication"
msgstr ""

#: judge/views/two_factor.py:117
Expand Down Expand Up @@ -5305,7 +5305,7 @@ msgid "Enter the 6-digit code generated by your app:"
msgstr ""

#: templates/registration/totp_enable.html:90
msgid "Refresh Two Factor Authentication"
msgid "Edit Two Factor Authentication"
msgstr ""

#: templates/registration/totp_enable.html:92
Expand Down Expand Up @@ -5811,7 +5811,7 @@ msgid "Two-factor Authentication is enabled:"
msgstr "2단계 인증이 활성화 되었습니다:"

#: templates/user/edit-profile.html:360
msgid "Refresh"
msgid "Edit 2FA"
msgstr "새로 고침"

#: templates/user/edit-profile.html:363
Expand Down
Loading

0 comments on commit adc44a5

Please sign in to comment.