Skip to content

Commit

Permalink
Fix send email on activation by administrator for only registered users.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlorenzetti committed Sep 29, 2023
1 parent f9e6559 commit 14a14e9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion g3w-admin/usersmanage/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def send_email_to_user(sender, **kwargs):

if (not hasattr(user, 'userdata') or
not sender.request.user.is_superuser or
user.userdata.registered == False or
user.userdata.activated_by_admin):
return

Expand All @@ -78,9 +79,14 @@ def send_email_to_user(sender, **kwargs):
# Send email to user
# ----------------------------------------------------------
scheme = "https" if hasattr(sender.request, 'is_secure') and sender.request.is_secure() else "http"
try:
site = get_current_site(sender.request)
except:
site = 'localhost'

context = {
"scheme": scheme,
"site": get_current_site(sender.request),
"site": site,
"user": user
}
subject = render_to_string(
Expand Down

0 comments on commit 14a14e9

Please sign in to comment.