mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
Add last resort
This commit is contained in:
parent
66a5af08eb
commit
de82da6e78
1 changed files with 6 additions and 1 deletions
|
@ -666,12 +666,17 @@ class DomainAddUserView(DomainFormBaseView):
|
||||||
# want to fix this upstream where it is happening.
|
# want to fix this upstream where it is happening.
|
||||||
raise ValueError("Can't send email. The given DomainInformation object has no requestor or creator.")
|
raise ValueError("Can't send email. The given DomainInformation object has no requestor or creator.")
|
||||||
|
|
||||||
|
# Attempt to grab the first and last names. As a last resort, just use the email.
|
||||||
if first and last:
|
if first and last:
|
||||||
full_name = f"{first} {last}"
|
full_name = f"{first} {last}"
|
||||||
|
elif requester.email is not None and requester.email.strip() != "":
|
||||||
|
full_name = requester.email
|
||||||
|
elif domainInfo.creator.email is not None and domainInfo.creator.email.strip() != "":
|
||||||
|
full_name = domainInfo.creator.email
|
||||||
else:
|
else:
|
||||||
# This edgecase would be unusual if encountered. We don't want to handle this here. Rather, we would
|
# This edgecase would be unusual if encountered. We don't want to handle this here. Rather, we would
|
||||||
# want to fix this upstream where it is happening.
|
# want to fix this upstream where it is happening.
|
||||||
raise ValueError("Can't send email. First and last names are none.")
|
raise ValueError("Can't send email. First and last names, as well as the email, are none.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
send_templated_email(
|
send_templated_email(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue