Skip to content

Commit

Permalink
Fixed #1607 - Added email validation for both blank and invalid email…
Browse files Browse the repository at this point in the history
… entries.
  • Loading branch information
maxxcrawford committed Apr 1, 2020
1 parent 9b34699 commit ed57b4c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions public/js/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,17 @@ function addBentoObserver(){
document.body.dataset.utm_content = "opt_out";
if (createFxaCheckbox.checked) {
e.preventDefault();

// Email Validation
const scanForm = document.getElementById("scan-user-email");
const scanFormEmailValue = document.querySelector("#scan-user-email input[type='email']");

if (scanFormEmailValue.value.length < 1 || !isValidEmail(scanFormEmailValue.value)) {
scanForm.classList.add("invalid");
return;
}

// Analytics
document.body.dataset.utm_content = "opt_in";
e.target.dataset.entrypoint = "fx-monitor-alert-me-blue-link";
if (typeof(ga) !== "undefined") {
Expand Down

0 comments on commit ed57b4c

Please sign in to comment.