411 |
411 |
if not getattr(instance, '_a2_created', True):
|
412 |
412 |
return instance
|
413 |
413 |
for key, value in attributes.items():
|
414 |
|
if is_verified.get(key):
|
415 |
|
setattr(instance.verified_attributes, key, value)
|
416 |
|
else:
|
417 |
|
setattr(instance.attributes, key, value)
|
|
414 |
verified = True if is_verified.get(key) else False
|
|
415 |
accessor = instance.verified_attributes if verified else instance.attributes
|
|
416 |
accessor._set_sourced_attr(key, value, 'api')
|
|
417 |
instance.refresh_from_db()
|
418 |
418 |
if is_verified.get('first_name'):
|
419 |
419 |
instance.verified_attributes.first_name = instance.first_name
|
|
420 |
Attribute.add_verification_source(instance, 'first_name', instance.first_name, 'api')
|
420 |
421 |
if is_verified.get('last_name'):
|
421 |
422 |
instance.verified_attributes.last_name = instance.last_name
|
|
423 |
Attribute.add_verification_source(instance, 'last_name', instance.last_name, 'api')
|
422 |
424 |
if password is not None:
|
423 |
425 |
instance.set_password(password)
|
424 |
426 |
else:
|
... | ... | |
466 |
468 |
instance.set_email_verified(False)
|
467 |
469 |
super().update(instance, validated_data)
|
468 |
470 |
for key, value in attributes.items():
|
469 |
|
if is_verified.get(key):
|
470 |
|
setattr(instance.verified_attributes, key, value)
|
471 |
|
else:
|
472 |
|
setattr(instance.attributes, key, value)
|
|
471 |
verified = True if is_verified.get(key) else False
|
|
472 |
accessor = instance.verified_attributes if verified else instance.attributes
|
|
473 |
accessor._set_sourced_attr(key, value, 'api')
|
473 |
474 |
for key in is_verified:
|
474 |
475 |
if key not in attributes:
|
475 |
|
if is_verified.get(key):
|
476 |
|
setattr(instance.verified_attributes, key, getattr(instance.attributes, key))
|
477 |
|
else:
|
478 |
|
setattr(instance.attributes, key, getattr(instance.attributes, key))
|
|
476 |
verified = True if is_verified.get(key) else False
|
|
477 |
accessor = instance.verified_attributes if verified else instance.attributes
|
|
478 |
accessor._set_sourced_attr(key, getattr(instance.attributes, key), 'api')
|
|
479 |
instance.refresh_from_db()
|
479 |
480 |
if is_verified.get('first_name'):
|
480 |
481 |
instance.verified_attributes.first_name = instance.first_name
|
|
482 |
Attribute.add_verification_source(instance, 'first_name', instance.first_name, 'api')
|
481 |
483 |
if is_verified.get('last_name'):
|
482 |
484 |
instance.verified_attributes.last_name = instance.last_name
|
|
485 |
Attribute.add_verification_source(instance, 'last_name', instance.last_name, 'api')
|
483 |
486 |
if password is not None:
|
484 |
487 |
instance.set_password(password)
|
485 |
488 |
instance.save()
|