registration: perform proper identifier verification (#79865) #108
|
@ -162,7 +162,6 @@ class RegistrationCompletionFormNoPassword(profile_forms.BaseUserForm):
|
|||
return BaseUserManager.normalize_email(email)
|
||||
|
||||
def save(self, commit=True):
|
||||
self.instance.set_email_verified(True, source='registration')
|
||||
self.instance.is_active = True
|
||||
return super().save(commit=commit)
|
||||
|
||||
|
|
|
@ -1782,8 +1782,6 @@ class RegistrationCompletionView(CreateView):
|
|||
attributes = {'ou': ou}
|
||||
if hasattr(self, 'email'):
|
||||
attributes['email'] = self.email
|
||||
if hasattr(self, 'phone'):
|
||||
|
||||
attributes['phone'] = self.phone
|
||||
|
||||
for key in self.token:
|
||||
if key in app_settings.A2_PRE_REGISTRATION_FIELDS:
|
||||
|
@ -1809,11 +1807,15 @@ class RegistrationCompletionView(CreateView):
|
|||
else:
|
||||
init_kwargs = {}
|
||||
keys = ['email', 'first_name', 'last_name', 'ou']
|
||||
# phone identifier is a separate attribute and is set post user-creation
|
||||
for key in keys:
|
||||
if key in attributes:
|
||||
init_kwargs[key] = attributes[key]
|
||||
kwargs['instance'] = get_user_model()(**init_kwargs)
|
||||
# phone identifier is a separate attribute and is set post user-creation
|
||||
if hasattr(self, 'phone'):
|
||||
kwargs['instance'].phone_verified_on = timezone.now()
|
||||
vdeniaud
commented
OK donc il y avait un deuxième bug, où le numéro de tel n'était lui pas marqué comme vérifié. OK donc il y avait un deuxième bug, où le numéro de tel n'était lui pas marqué comme vérifié.
|
||||
elif hasattr(self, 'email'):
|
||||
kwargs['instance'].set_email_verified(True, source='registration')
|
||||
|
||||
return kwargs
|
||||
|
||||
|
|
|
@ -1087,6 +1087,8 @@ def test_phone_registration(app, db, settings, phone_activated_authn):
|
|||
|
||||
user = User.objects.get(first_name='John', last_name='Doe')
|
||||
assert user.attributes.phone == '+33612345678'
|
||||
assert user.phone_verified_on
|
||||
assert not user.email_verified
|
||||
|
||||
|
||||
def test_phone_registration_nondefault_attribute(app, db, settings):
|
||||
|
|
Loading…
Reference in New Issue
Et ici il y avait une ligne inutile.