Skip to content

Commit

Permalink
improve subdomain logic
Browse files Browse the repository at this point in the history
  • Loading branch information
auumgn committed Dec 16, 2024
1 parent a8f71da commit c2fe5ba
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ export class ModalEmailComponent implements OnInit, OnDestroy {
if (domain) {
const remainingEmailsHaveDomain = this.emails.find((email) =>
email
? email.verified && email.value.split('@')[1].endsWith(domain)
? email.verified &&
(email.value.split('@')[1].endsWith('.' + domain) ||
email.value.split('@')[1] === domain)
: false
)
if (!remainingEmailsHaveDomain) {
Expand Down Expand Up @@ -581,7 +583,10 @@ export class ModalEmailComponent implements OnInit, OnDestroy {
if (controlKey.startsWith('emailInput')) {
const control = this.emailsForm.get(controlKey).value

if (control.email.split('@')[1].endsWith(domain)) {
if (
control.email.split('@')[1].endsWith('.' + domain) ||
control.email.split('@')[1] === domain
) {
visibilities.push(control.visibility)
}
}
Expand Down Expand Up @@ -614,7 +619,10 @@ export class ModalEmailComponent implements OnInit, OnDestroy {
Object.keys(this.emailsForm.controls).forEach((controlKey) => {
if (controlKey.startsWith('emailInput')) {
const control = this.emailsForm.get(controlKey)
if (control.value.email.split('@')[1].endsWith(domain)) {
if (
control.value.email.split('@')[1].endsWith('.' + domain) ||
control.value.email.split('@')[1] === domain
) {
if (this.isEmailVerified(control.value.email)) {
visibilities.push(control.value.visibility)
}
Expand Down

0 comments on commit c2fe5ba

Please sign in to comment.