Skip to content

Commit

Permalink
Add save of 'other_info' userdata property.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlorenzetti committed Sep 21, 2023
1 parent fad17a8 commit 305ad69
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
18 changes: 15 additions & 3 deletions g3w-admin/usersmanage/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.conf import settings
from django.dispatch import receiver
from django_registration.signals import user_registered
from usersmanage.models import Userbackend, USER_BACKEND_DEFAULT, Group as AuthGroup
from usersmanage.models import Userbackend, USER_BACKEND_DEFAULT, Group as AuthGroup, Userdata
from usersmanage.configs import G3W_VIEWER1
import logging

Expand All @@ -26,8 +26,20 @@ def set_user_backend(sender, **kwargs):
"""

# Set default g3w-suite backend
Userbackend(user=kwargs['user'], backend=USER_BACKEND_DEFAULT).save()
logger.info(f"Assigned backend {USER_BACKEND_DEFAULT} to registered user {kwargs['user']}")
user = kwargs['user']
Userbackend(user=user, backend=USER_BACKEND_DEFAULT).save()
logger.info(f"Assigned backend {USER_BACKEND_DEFAULT} to registered user {user}")

# If set save `Other information`
if kwargs["request"].POST["other_info"] != "":
if hasattr(user, "userdata"):
user.userdata.other_info = kwargs["request"].POST["other_info"]
user.userdata.save()
else:
Userdata(
user=user,
other_info=kwargs["request"].POST["other_info"]
).save()

# Set default registration role
if hasattr(settings, 'REGISTRATION_MAIN_ROLES'):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Dear {{user.username}},
Dear {{ user.username }},

please got to the following link or copy it and paste in you browser to activate your account and validate your email.

{% url 'django_registration_activate' activation_key %}
{{ scheme }}://{{ site }}{% url 'django_registration_activate' activation_key %}

The link will be active for {{ expiration_days }} days!

0 comments on commit 305ad69

Please sign in to comment.