Skip to content

Commit

Permalink
feat(session): get the verified email
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman committed Jan 28, 2025
1 parent 538e108 commit 7816ab5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions web/vital_records/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ def __init__(self, request, reset=False):
self.oauth_claims_eligibility = self.userflow.eligibility_claim
self.oauth_redirect_failure = self.userflow.redirect_failure
self.oauth_redirect_success = self.userflow.redirect_success

@property
def verified_email(self):
claims = self.oauth_claims_verified.split(" ")
if "email_verified" in claims:
for claim in claims:
if claim.startswith("email:"):
return claim.split(":")[1]
return ""
3 changes: 3 additions & 0 deletions web/vital_records/templates/vital_records/request.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
{% endblock headline %}
{% block inner-content %}
<p>You are in a confirmed disaster affected area.</p>
<p>
Your verified email address: <strong>{{ email }}</strong>
</p>
<p>
<a class="btn btn-primary" href="{% url 'vital_records:submitted' %}">Submit your Vital Records request</a>
</p>
Expand Down
3 changes: 2 additions & 1 deletion web/vital_records/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def index(request: HttpRequest):


def request(request: HttpRequest):
return TemplateResponse(request, "vital_records/request.html")
session = Session(request)
return TemplateResponse(request, "vital_records/request.html", {"email": session.verified_email})


def submitted(request: HttpRequest):
Expand Down

0 comments on commit 7816ab5

Please sign in to comment.