mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
Do not send email if user email is not set
This commit is contained in:
parent
5a19f0c949
commit
1f26bd0c31
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
send_email_with_otp(user, device)
|
||||
messages.success(request, _('OTP QR code was emailed to user %s') % 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)
|
||||
|
|
Loading…
Reference in a new issue