Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for issue #507 and issue #467 #509

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openwisp_radius/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class RadiusPostAuthSerializer(serializers.ModelSerializer):
allow_blank=True,
style={'input_type': 'password'},
)
called_station_id = serializers.CharField(required=False, allow_blank=True)
called_station_id = serializers.CharField(required=False, allow_blank=True,max_length=50)
calling_station_id = serializers.CharField(required=False, allow_blank=True)

def validate(self, data):
Expand Down
15 changes: 9 additions & 6 deletions openwisp_radius/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,24 @@ def send_email_on_new_accounting_handler(sender, accounting_data, view, **kwargs

def set_default_group_handler(sender, instance, created, **kwargs):
if created:

RadiusGroup = load_model('RadiusGroup')
RadiusUserGroup = load_model('RadiusUserGroup')
queryset = RadiusGroup.objects.filter(
default=True, organization_id=instance.organization_id
default=True, organization_id=instance.organization_id
)
if (
queryset.exists()
and not instance.user.radiususergroup_set.filter(
group__organization_id=instance.organization_id
).exists()
):
ug = RadiusUserGroup(user=instance.user, group=queryset.first())
ug.full_clean()
ug.save()

):
try:
ug = RadiusUserGroup(user=instance.user, group=queryset.first())
ug.full_clean()
ug.save()
except Exception as e:
logger.warning("An exception occurred:", e)

def create_default_groups_handler(sender, instance, created, **kwargs):
if created:
Expand Down