mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-10-06 14:05:24 +00:00
feat(verification): handle user verification not found scenario and mark user as verified ✨
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m0s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m0s
This commit is contained in:
10
api/views.py
10
api/views.py
@@ -414,6 +414,16 @@ class UserVerifyAPIView(StaffEditorPermissionMixin, generics.UpdateAPIView):
|
||||
serializer = self.get_serializer(user, data=request.data, partial=True)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
result = check_person_api_verification(user_data=user, id_card=user.id_card)
|
||||
# The verification system might not have the records of every user hence can be skipped if not found and verify directly.
|
||||
if result.get("error") == "Not Found":
|
||||
user.verified = True
|
||||
user.save()
|
||||
return Response(
|
||||
{
|
||||
"message": "User not found in the verification system. User marked as verified."
|
||||
},
|
||||
status=status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
if not result["ok"]:
|
||||
return Response(
|
||||
result,
|
||||
|
Reference in New Issue
Block a user