From e65a1026f8bc842b690cc685e6b15a4bc709efdf Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Mon, 19 Apr 2021 21:07:15 -0700 Subject: [PATCH] update enable_totp(request) redirect if totp is already enabled --- accounts/enable_totp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/accounts/enable_totp.py b/accounts/enable_totp.py index 117f5a4..870088f 100644 --- a/accounts/enable_totp.py +++ b/accounts/enable_totp.py @@ -26,6 +26,8 @@ def disable_totp(request): def enable_totp(request): if not request.user.is_authenticated: return redirect('audio:home') + if request.user.account.use_totp and request.user.account.totp_key is not None: + return(redirect('accounts:edit_profile')) qr = get_totp_qr(request.user) if request.method == "POST": form = EnableTotpForm(request.POST, instance=request.user.account)