mwatson-nvidia commited on
Commit
13c846c
·
1 Parent(s): 7404e13

remove optional email

Browse files
Files changed (3) hide show
  1. README.md +2 -1
  2. app.py +6 -18
  3. registration_validation.py +8 -8
README.md CHANGED
@@ -20,7 +20,8 @@ This Docker Space serves a static landing page with an embedded Gradio app for:
20
 
21
  Participants connect their Hugging Face account from the registration page. The
22
  Space uses the signed-in Hugging Face profile to capture the captain username,
23
- stable Hugging Face `sub`, and email when available.
 
24
 
25
  The Space must define these secrets:
26
 
 
20
 
21
  Participants connect their Hugging Face account from the registration page. The
22
  Space uses the signed-in Hugging Face profile to capture the captain username,
23
+ stable Hugging Face `sub`, and primary email. The primary email is the captain
24
+ contact email; it cannot be overridden in the registration form.
25
 
26
  The Space must define these secrets:
27
 
app.py CHANGED
@@ -1413,7 +1413,6 @@ def submit_registration(
1413
  team_display_name: str,
1414
  team_id: str,
1415
  captain_name: str,
1416
- contact_email: str,
1417
  additional_submitters: str,
1418
  credited_contributors: str,
1419
  organization: str,
@@ -1433,7 +1432,7 @@ def submit_registration(
1433
  return "Please accept all required acknowledgments.", "", "", gr.update(visible=True)
1434
 
1435
  profile_email = profile_value(profile, "email")
1436
- contact_error = registration_contact_error(contact_email, profile_email, organization)
1437
  if contact_error:
1438
  return contact_error, "", "", gr.update(visible=True)
1439
 
@@ -1448,13 +1447,11 @@ def submit_registration(
1448
 
1449
  captain_hf_user_id = profile_value(profile, "sub")
1450
  captain_hf_username = profile_value(profile, "preferred_username", "name")
1451
- captain_email = contact_email.strip() or profile_email
1452
-
1453
  payload = {
1454
  "team_display_name": team_display_name.strip(),
1455
  "team_id": team_id.strip(),
1456
  "captain_name": captain_name.strip(),
1457
- "captain_email": captain_email,
1458
  "captain_hf_user_id": captain_hf_user_id,
1459
  "captain_hf_username": captain_hf_username,
1460
  "submitter_hf_usernames": split_multivalue(additional_submitters),
@@ -1714,9 +1711,9 @@ with gr.Blocks(
1714
 
1715
  with gr.Group(visible=False) as registration_form:
1716
  gr.Markdown(
1717
- "An academic, company, or organization email and an organization "
1718
- "name are required. Applications using common personal email services "
1719
- "cannot be submitted."
1720
  )
1721
 
1722
  with gr.Row():
@@ -1734,14 +1731,6 @@ with gr.Blocks(
1734
 
1735
  with gr.Row():
1736
  captain_name = gr.Textbox(label="Captain Full Name", max_lines=1)
1737
- contact_email = gr.Textbox(
1738
- label="Captain Contact / Organization Email (required)",
1739
- max_lines=1,
1740
- info=(
1741
- "Use an academic, company, or organization email. "
1742
- "Common personal email services are not accepted."
1743
- ),
1744
- )
1745
 
1746
  additional_submitters = gr.Textbox(
1747
  label="Additional Submitter Hugging Face Usernames",
@@ -1764,7 +1753,7 @@ with gr.Blocks(
1764
  notes = gr.Textbox(label="Notes To Organizers", lines=3)
1765
 
1766
  organization_email_ack = gr.Checkbox(
1767
- label="I have provided an academic, company, or organization email address."
1768
  )
1769
  roster_ack = gr.Checkbox(
1770
  label="I understand that the submitter roster is frozen after approval except by administrator exception."
@@ -2004,7 +1993,6 @@ with gr.Blocks(
2004
  team_display_name,
2005
  team_id,
2006
  captain_name,
2007
- contact_email,
2008
  additional_submitters,
2009
  credited_contributors,
2010
  organization,
 
1413
  team_display_name: str,
1414
  team_id: str,
1415
  captain_name: str,
 
1416
  additional_submitters: str,
1417
  credited_contributors: str,
1418
  organization: str,
 
1432
  return "Please accept all required acknowledgments.", "", "", gr.update(visible=True)
1433
 
1434
  profile_email = profile_value(profile, "email")
1435
+ contact_error = registration_contact_error(profile_email, organization)
1436
  if contact_error:
1437
  return contact_error, "", "", gr.update(visible=True)
1438
 
 
1447
 
1448
  captain_hf_user_id = profile_value(profile, "sub")
1449
  captain_hf_username = profile_value(profile, "preferred_username", "name")
 
 
1450
  payload = {
1451
  "team_display_name": team_display_name.strip(),
1452
  "team_id": team_id.strip(),
1453
  "captain_name": captain_name.strip(),
1454
+ "captain_email": profile_email,
1455
  "captain_hf_user_id": captain_hf_user_id,
1456
  "captain_hf_username": captain_hf_username,
1457
  "submitter_hf_usernames": split_multivalue(additional_submitters),
 
1711
 
1712
  with gr.Group(visible=False) as registration_form:
1713
  gr.Markdown(
1714
+ "Your Hugging Face primary email must be an academic, company, or "
1715
+ "organization address. An organization name is also required. "
1716
+ "Applications using common personal email services cannot be submitted."
1717
  )
1718
 
1719
  with gr.Row():
 
1731
 
1732
  with gr.Row():
1733
  captain_name = gr.Textbox(label="Captain Full Name", max_lines=1)
 
 
 
 
 
 
 
 
1734
 
1735
  additional_submitters = gr.Textbox(
1736
  label="Additional Submitter Hugging Face Usernames",
 
1753
  notes = gr.Textbox(label="Notes To Organizers", lines=3)
1754
 
1755
  organization_email_ack = gr.Checkbox(
1756
+ label="My Hugging Face primary email is an academic, company, or organization address."
1757
  )
1758
  roster_ack = gr.Checkbox(
1759
  label="I understand that the submitter roster is frozen after approval except by administrator exception."
 
1993
  team_display_name,
1994
  team_id,
1995
  captain_name,
 
1996
  additional_submitters,
1997
  credited_contributors,
1998
  organization,
registration_validation.py CHANGED
@@ -70,20 +70,20 @@ def uses_common_personal_email_service(email: str) -> bool:
70
 
71
 
72
  def registration_contact_error(
73
- contact_email: str,
74
  profile_email: str,
75
  organization: str,
76
  ) -> str | None:
77
- """Return a user-facing error when registration contact details are invalid."""
78
  if not (organization or "").strip():
79
  return "Organization / Affiliation is required."
80
 
81
- effective_email = (contact_email or "").strip() or (profile_email or "").strip()
82
- if email_domain(effective_email) is None:
83
- return "Enter a valid Captain Contact / Organization Email."
84
- if uses_common_personal_email_service(effective_email):
85
  return (
86
- "Use an academic, company, or organization email address. "
87
- "Addresses from common personal email services are not accepted."
 
88
  )
89
  return None
 
70
 
71
 
72
  def registration_contact_error(
 
73
  profile_email: str,
74
  organization: str,
75
  ) -> str | None:
76
+ """Return a user-facing error for the OAuth-provided contact email."""
77
  if not (organization or "").strip():
78
  return "Organization / Affiliation is required."
79
 
80
+ profile_email = (profile_email or "").strip()
81
+ if email_domain(profile_email) is None:
82
+ return "Your Hugging Face account must provide a valid primary email address."
83
+ if uses_common_personal_email_service(profile_email):
84
  return (
85
+ "Your Hugging Face primary email must be an academic, company, or "
86
+ "organization address. Addresses from common personal email services "
87
+ "are not accepted."
88
  )
89
  return None