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