diff --git a/wildlifecompliance/components/users/api.py b/wildlifecompliance/components/users/api.py index 4c0ee7760..f187c90e6 100644 --- a/wildlifecompliance/components/users/api.py +++ b/wildlifecompliance/components/users/api.py @@ -10,7 +10,7 @@ #from rest_framework.decorators import detail_route, list_route from rest_framework.response import Response from rest_framework.renderers import JSONRenderer -from ledger.accounts.models import EmailUser, Address, Profile, EmailIdentity, EmailUserAction +from ledger.accounts.models import EmailUser, Address, Profile, EmailIdentity, EmailUserAction, PrivateDocument from django.contrib.auth.models import Permission, ContentType from datetime import datetime from django_countries import countries @@ -575,7 +575,14 @@ def upload_id(self, request, *args, **kwargs): with transaction.atomic(): private_doc = instance.identification2 private_doc.file_group = 1 - private_doc.extension = "".join(pathlib.Path(request.data.dict()['identification2'].name).suffixes) + private_doc.name = pathlib.Path(request.data.dict()['identification2'].name).name + private_doc.extension = pathlib.Path( + request.data.dict()['identification2'].name + ).suffix if (len( + pathlib.Path( + request.data.dict()['identification2'].name + ).suffix) <= PrivateDocument._meta.get_field('extension').max_length + ) else "" private_doc.save() instance.save() instance.log_user_action( diff --git a/wildlifecompliance/components/users/serializers.py b/wildlifecompliance/components/users/serializers.py index 938e8a30b..049544c64 100644 --- a/wildlifecompliance/components/users/serializers.py +++ b/wildlifecompliance/components/users/serializers.py @@ -370,6 +370,7 @@ class FirstTimeUserSerializer(UserSerializer): has_complete_first_time = serializers.SerializerMethodField(read_only=True) prefer_compliance_management = serializers.SerializerMethodField(read_only=True) is_compliance_management_approved_external_user = serializers.SerializerMethodField(read_only=True) + sso_setting_url = serializers.SerializerMethodField(read_only=True) class Meta: model = EmailUser @@ -397,6 +398,7 @@ class Meta: 'has_complete_first_time', 'prefer_compliance_management', 'is_compliance_management_approved_external_user', + 'sso_setting_url', ) def get_has_complete_first_time(self, obj): @@ -423,6 +425,8 @@ def get_prefer_compliance_management(self, obj): def get_is_compliance_management_approved_external_user(self, obj): return is_compliance_management_approved_external_user(self.context.get('request')) + def get_sso_setting_url(self, obj): + return settings.SSO_SETTING_URL class DTUserSerializer(serializers.ModelSerializer): @@ -481,6 +485,7 @@ class MyUserDetailsSerializer(serializers.ModelSerializer): legal_dob = serializers.SerializerMethodField(read_only=True) is_payment_officer = serializers.SerializerMethodField(read_only=True) has_complete_first_time = serializers.SerializerMethodField(read_only=True) + sso_setting_url = serializers.SerializerMethodField(read_only=True) class Meta: model = EmailUser @@ -512,6 +517,7 @@ class Meta: 'has_complete_first_time', 'is_compliance_management_user', 'is_compliance_management_approved_external_user', + 'sso_setting_url', ) def get_has_complete_first_time(self, obj): @@ -592,7 +598,9 @@ def get_prefer_compliance_management(self, obj): def get_is_reception(self, obj): return is_reception(self.context.get('request')) - + + def get_sso_setting_url(self, obj): + return settings.SSO_SETTING_URL class ComplianceUserDetailsSerializer(serializers.ModelSerializer): residential_address = UserAddressSerializer() diff --git a/wildlifecompliance/frontend/wildlifecompliance/src/components/user/manage_my_user_details.vue b/wildlifecompliance/frontend/wildlifecompliance/src/components/user/manage_my_user_details.vue index 03635e6f9..320509cfc 100644 --- a/wildlifecompliance/frontend/wildlifecompliance/src/components/user/manage_my_user_details.vue +++ b/wildlifecompliance/frontend/wildlifecompliance/src/components/user/manage_my_user_details.vue @@ -32,7 +32,7 @@