Skip to content

Commit

Permalink
fix for domain names
Browse files Browse the repository at this point in the history
  • Loading branch information
keyserfaty committed Sep 28, 2023
1 parent f6cc8ed commit 0ef4f15
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,18 @@

const $errorMsg = document.querySelector('.step-5-error')

const invalidEmail = !REGEX_VALID_EMAIL.test($form.value) || FORBIDDEN_DOMAINS.includes($form.value)
$errorMsg.style.display = invalidEmail ? 'block' : 'none'
if (REGEX_VALID_EMAIL.test($form.value)) {
const emailDomain = $form.value.split('@')[1].split('.')[0]

return invalidEmail
if (FORBIDDEN_DOMAINS.includes(emailDomain)) {
$errorMsg.setAttribute('style', 'display: block;')
return true
}

return false
}

return true
}

default:
Expand Down

0 comments on commit 0ef4f15

Please sign in to comment.