Skip to content

Commit

Permalink
Remove clean and get choices methods
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb committed Sep 12, 2023
1 parent 0858397 commit d106a17
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/peoplefinder/forms/profile_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,31 +191,6 @@ def __init__(self, *args, **kwargs):
),
)

def get_email_choices(self) -> List[str]:
verified_emails = PersonService.get_verified_emails(self.instance)
choices = []
if self.instance.email in verified_emails:
choices += [self.instance.email]
choices += [email for email in verified_emails if email not in choices]
if not choices:
return [self.instance.email]
return choices

def clean_email(self):
email = self.cleaned_data["email"]

validate_email(email)

verified_emails = PersonService.get_verified_emails(self.instance)
if verified_emails == []:
raise Exception("Could not retrieve valid emails for this user")
if email not in verified_emails:
raise ValidationError(
"Email address must be officially assigned and verified by SSO authentication"
)

return email


class TeamsProfileEditForm(forms.ModelForm):
class Meta:
Expand Down

0 comments on commit d106a17

Please sign in to comment.