mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-10-05 13:35:23 +00:00
move registration sms to view from signals and fix include User verified
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m2s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m2s
attribute 🐛
This commit is contained in:
@@ -159,7 +159,7 @@ class UserSerializer(serializers.ModelSerializer):
|
|||||||
extra_kwargs = {"password": {"write_only": True, "min_length": 5}}
|
extra_kwargs = {"password": {"write_only": True, "min_length": 5}}
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
return User.objects.create_user(**validated_data)
|
return User.objects.create_user(**validated_data) #type: ignore
|
||||||
|
|
||||||
|
|
||||||
class AuthSerializer(serializers.Serializer):
|
class AuthSerializer(serializers.Serializer):
|
||||||
|
@@ -230,19 +230,11 @@ def verify_user_with_person_api_task(user_id: int):
|
|||||||
):
|
):
|
||||||
t_user.t_verified = True
|
t_user.t_verified = True
|
||||||
t_user.save()
|
t_user.save()
|
||||||
send_sms(
|
|
||||||
t_user.t_mobile,
|
|
||||||
f"Dear {t_user.t_first_name} {t_user.t_last_name}, \n\nYour account has been successfully verified. \n\nYou can now manage your devices and make payments through our portal at https://portal.sarlink.net. \n\n - SAR Link",
|
|
||||||
)
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
t_user.t_verified = False
|
t_user.t_verified = False
|
||||||
t_user.save()
|
t_user.save()
|
||||||
|
|
||||||
send_sms(
|
|
||||||
t_user.t_mobile,
|
|
||||||
f"Dear {t_user.t_first_name} {t_user.t_last_name}, \n\nYour account registration is being processed. \n\nWe will notify you once verification is complete. \n\n - SAR Link",
|
|
||||||
)
|
|
||||||
# send_clean_telegram_markdown(message=verification_failed_message)
|
# send_clean_telegram_markdown(message=verification_failed_message)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
19
api/views.py
19
api/views.py
@@ -183,17 +183,34 @@ class VerifyOTPView(generics.GenericAPIView):
|
|||||||
acc_no=temp_user.t_acc_no,
|
acc_no=temp_user.t_acc_no,
|
||||||
id_card=temp_user.t_id_card,
|
id_card=temp_user.t_id_card,
|
||||||
dob=temp_user.t_dob,
|
dob=temp_user.t_dob,
|
||||||
|
verified=temp_user.t_verified,
|
||||||
atoll=temp_user.t_atoll,
|
atoll=temp_user.t_atoll,
|
||||||
island=temp_user.t_island,
|
island=temp_user.t_island,
|
||||||
terms_accepted=temp_user.t_terms_accepted,
|
terms_accepted=temp_user.t_terms_accepted,
|
||||||
policy_accepted=temp_user.t_policy_accepted,
|
policy_accepted=temp_user.t_policy_accepted,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if temp_user.t_verified:
|
||||||
|
send_sms(
|
||||||
|
t_user.t_mobile,
|
||||||
|
f"Dear {temp_user.t_first_name} {temp_user.t_last_name}, \n\nYour account has been successfully verified. \n\nYou can now manage your devices and make payments through our portal at https://portal.sarlink.net. \n\n - SAR Link",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
send_sms(
|
||||||
|
t_user.t_mobile,
|
||||||
|
f"Dear {t_user.t_first_name} {t_user.t_last_name}, \n\nYour account registration is being processed. \n\nWe will notify you once verification is complete. \n\n - SAR Link",
|
||||||
|
)
|
||||||
|
|
||||||
# You can now trigger registry verification as a signal or task
|
# You can now trigger registry verification as a signal or task
|
||||||
temp_user.otp_verified = True
|
temp_user.otp_verified = True
|
||||||
temp_user.save()
|
temp_user.save()
|
||||||
|
|
||||||
return Response({"message": "User created successfully."})
|
return Response(
|
||||||
|
{
|
||||||
|
"message": "User created successfully.",
|
||||||
|
"verified": temp_user.t_verified
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class LoginView(KnoxLoginView):
|
class LoginView(KnoxLoginView):
|
||||||
|
Reference in New Issue
Block a user