1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

Do not send email if user email is not set

This commit is contained in:
Real-Gecko 2020-10-19 17:11:28 +06:00
parent 5a19f0c949
commit 1f26bd0c31

View file

@ -170,6 +170,9 @@ def email_otp(request):
def admin_email_otp(request, user_id):
user = get_object_or_404(get_user_model(), pk=user_id)
device = get_user_totp_device(user)
if user.email != '':
send_email_with_otp(user, device)
messages.success(request, _('OTP QR code was emailed to user %s') % user)
else:
messages.error(request, _('User email not set, failed to send QR code'))
return redirect('accounts:account', user.id)