Allow users not yet in LDAP to claim old portal accounts

This commit is contained in:
Tanner Collin 2020-02-14 05:19:59 +00:00
parent ef16bf1cb3
commit d4871feb8d

View File

@ -232,14 +232,14 @@ def link_old_member(data, user):
if utils_ldap.is_configured():
result = utils_ldap.find_user(user.username)
if result == 200:
pass
if utils_ldap.set_password(data) != 200:
raise ValidationError(dict(non_field_errors='Problem connecting to LDAP server: set.'))
elif result == 404:
raise ValidationError(dict(username='Unable to find username in old portal.'))
if utils_ldap.create_user(data) != 200:
raise ValidationError(dict(non_field_errors='Problem connecting to LDAP server: create.'))
else:
raise ValidationError(dict(non_field_errors='Problem connecting to LDAP server: find.'))
if utils_ldap.set_password(data) != 200:
raise ValidationError(dict(non_field_errors='Problem connecting to LDAP server: set.'))
member.user = user
member.first_name = data['first_name']