update enable_totp(request) redirect if totp is already enabled

This commit is contained in:
Trent Palmer 2021-04-19 21:07:15 -07:00
parent 5b99609dc7
commit e65a1026f8
1 changed files with 2 additions and 0 deletions

View File

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