Skip to content

Commit

Permalink
Merge pull request #2260 from mozilla/fix-prompt-none-code-in-bundle
Browse files Browse the repository at this point in the history
check .nav-user-email exists before referencing
  • Loading branch information
groovecoder authored Aug 23, 2021
2 parents 04e0bbd + efc7ac6 commit e85671a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions public/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ if (removeMonitorButton) {
}

const relayLink = document.querySelector("[data-event-label='Try Firefox Relay']");
const user_email = document.querySelector(".nav-user-email").textContent;
if (user_email) {
const relayUrl = new URL(relayLink.href);
relayUrl.pathname += "accounts/fxa/login/";
relayUrl.searchParams.append("process", "login");
relayUrl.searchParams.append("auth_params", "prompt=none&login_hint=" + user_email);
relayLink.href = relayUrl.href;
const userEmailElement = document.querySelector(".nav-user-email");
if (userEmailElement) {
const user_email = userEmailElement.textContent;
if (user_email) {
const relayUrl = new URL(relayLink.href);
relayUrl.pathname += "accounts/fxa/login/";
relayUrl.searchParams.append("process", "login");
relayUrl.searchParams.append("auth_params", "prompt=none&login_hint=" + user_email);
relayLink.href = relayUrl.href;
}
}

0 comments on commit e85671a

Please sign in to comment.