Skip to content

Commit

Permalink
feat(web.email-domaine): add dkim feature (#14362)
Browse files Browse the repository at this point in the history
ref: MANAGER-16163

Signed-off-by: Guillaume Hyenne <[email protected]>
Co-authored-by: CDS Translator Agent <[email protected]>
  • Loading branch information
ghyenne and ovh-cds authored Jan 2, 2025
1 parent e794a6d commit 3e7198d
Show file tree
Hide file tree
Showing 26 changed files with 527 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "Liste der vergebenen Rechte für das Konto <strong>{{t0}}</strong>",
"email_tab_popover_delegate_format_error": "Ungültiges Format Kundenkennung",
"emails_create_account": "Account erstellen",
"emails_create_account_new_window": "(Neues Fenster)"
"emails_create_account_new_window": "(Neues Fenster)",
"emails_general_information_diagnostic": "Diagnose",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "List of delegations for the <strong>{{t0}}</strong> account",
"email_tab_popover_delegate_format_error": "NIC handle format not valid ",
"emails_create_account": "Create an account",
"emails_create_account_new_window": "(New window)"
"emails_create_account_new_window": "(New window)",
"emails_general_information_diagnostic": "Diagnostic",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "Lista de delegaciones para la cuenta <strong>{{t0}}</strong>",
"email_tab_popover_delegate_format_error": "Formato del ID de cliente no válido.",
"emails_create_account": "Crear una cuenta",
"emails_create_account_new_window": "(Nueva ventana)"
"emails_create_account_new_window": "(Nueva ventana)",
"emails_general_information_diagnostic": "Diagnóstico",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "Liste des délégations pour le compte <strong>{{t0}}</strong>",
"email_tab_popover_delegate_format_error": "Format du NIC-handle invalide",
"emails_create_account": "Créer un compte",
"emails_create_account_new_window": "(Nouvelle fenêtre)"
"emails_create_account_new_window": "(Nouvelle fenêtre)",
"emails_general_information_diagnostic": "Diagnostique",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "Liste des délégations pour le compte <strong>{{t0}}</strong>",
"email_tab_popover_delegate_format_error": "Format du NIC-handle invalide",
"emails_create_account": "Créer un compte",
"emails_create_account_new_window": "(Nouvelle fenêtre)"
"emails_create_account_new_window": "(Nouvelle fenêtre)",
"emails_general_information_diagnostic": "Diagnostique",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "Lista delle deleghe per l'account <strong>{{t0}}</strong>",
"email_tab_popover_delegate_format_error": "Il formato del NIC handle non è valido",
"emails_create_account": "Crea un account",
"emails_create_account_new_window": "(nuova finestra)"
"emails_create_account_new_window": "(nuova finestra)",
"emails_general_information_diagnostic": "Diagnostica",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "Lista delegowania uprawnień dla konta <strong>{{t0}}</strong>",
"email_tab_popover_delegate_format_error": "Nieprawidłowy format identyfikatora klienta",
"emails_create_account": "Załóż konto",
"emails_create_account_new_window": "(Nowe okno)"
"emails_create_account_new_window": "(Nowe okno)",
"emails_general_information_diagnostic": "Diagnostyka",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,7 @@
"email_tab_popover_delegate_info": "Lista das delegações para a conta <strong>{{t0}}</strong>",
"email_tab_popover_delegate_format_error": "Formato do ID de cliente inválido",
"emails_create_account": "Criar uma conta",
"emails_create_account_new_window": "(Nova janela)"
"emails_create_account_new_window": "(Nova janela)",
"emails_general_information_diagnostic": "Diagnóstico",
"emails_general_information_diagnostic_dkim": "DKIM"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import controller from './email-domain-dkim.controller';
import template from './email-domain-dkim.html';

export default {
bindings: {
serviceName: '<',
goBack: '<',
dkim: '<',
},
controller,
template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const DKIM_TRANSLATION_PREFIX = 'email_domain_dkim_';

export const DKIM_STATUS = {
ENABLED: 'enabled',
DISABLED: 'disabled',
DISABLED_NO_SET: 'error',
ERROR: 'error',
TO_CONFIGURE: 'toConfigure',
MODIFYING: 'modifying',
};

export const DKIM_STATUS_TEXT = {
[DKIM_STATUS.ENABLED]: `${DKIM_TRANSLATION_PREFIX}deactivation`,
[DKIM_STATUS.DISABLED]: `${DKIM_TRANSLATION_PREFIX}activation`,
[DKIM_STATUS.MODIFYING]: `${DKIM_TRANSLATION_PREFIX}in_progress`,
};

export const DKIM_STATUS_CLASS = {
[DKIM_STATUS.ENABLED]: 'oui-badge_success',
[DKIM_STATUS.DISABLED]: 'oui-badge_warning',
[DKIM_STATUS.DISABLED_NO_SET]: 'oui-badge_error',
[DKIM_STATUS.TO_CONFIGURE]: 'oui-badge_error',
[DKIM_STATUS.MODIFYING]: 'oui-badge_info',
[DKIM_STATUS.ERROR]: 'oui-badge_error',
};

export const DKIM_MODAL_TITLE = {
[DKIM_STATUS.ENABLED]: `${DKIM_TRANSLATION_PREFIX}title_desactivation `,
[DKIM_STATUS.DISABLED]: `${DKIM_TRANSLATION_PREFIX}title_activation`,
[DKIM_STATUS.MODIFYING]: `${DKIM_TRANSLATION_PREFIX}title_configuration`,
};

export const DKIM_PRIMARY_BUTTON_LABEL = {
[DKIM_STATUS.ENABLED]: `${DKIM_TRANSLATION_PREFIX}deactivate`,
[DKIM_STATUS.DISABLED]: `${DKIM_TRANSLATION_PREFIX}activate`,
[DKIM_STATUS.MODIFYING]: 'wizard_close',
};

export const DKIM_SECONDARY_BUTTON_LABEL = {
[DKIM_STATUS.ENABLED]: 'common_cancel',
[DKIM_STATUS.DISABLED]: 'common_cancel',
[DKIM_STATUS.MODIFYING]: null,
};

export const DKIM_CONFIGURATION_GUIDE_NO_OVH = {
US:
'https://help.ovhcloud.com/csm/en-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058258#configuring-dkim-for-an-email-solution-outside-of-your-ovhcloud-account',
DE:
'https://help.ovhcloud.com/csm/de-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058380#dkim-fur-einen-e-mail-dienst-auerhalb-ihres-ovhcloud-kunden-accounts-konfigurieren',
ES:
'https://help.ovhcloud.com/csm/es-es-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058253#configurar-el-dkim-para-una-solucion-de-correo-electronico-fuera-de-su-cuenta-de-ovhcloud',
FR:
'https://help.ovhcloud.com/csm/fr-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058101#configurer-le-dkim-pour-une-offre-e-mail-hors-de-votre-compte-ovhcloud',
IE:
'https://help.ovhcloud.com/csm/en-ie-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058259#configuring-dkim-for-an-email-solution-outside-of-your-ovhcloud-account',
IT:
'https://help.ovhcloud.com/csm/it-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058256#configurare-il-dkim-per-unofferta-email-al-di-fuori-del-tuo-account-ovhcloud',
NL:
'https://help.ovhcloud.com/csm/en-ie-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058259#external-dkim',
PL:
'https://help.ovhcloud.com/csm/pl-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058254#konfiguracja-dkim-w-przypadku-oferty-e-mail-poza-twoim-kontem-ovhcloud',
PT:
'https://help.ovhcloud.com/csm/pt-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058255#configurar-o-dkim-para-uma-oferta-de-e-mail-fora-da-sua-conta-ovhcloud',
GB:
'https://help.ovhcloud.com/csm/en-gb-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058238#configuring-dkim-for-an-email-solution-outside-of-your-ovhcloud-account',
CA:
'https://help.ovhcloud.com/csm/en-ca-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058260#external-dkim',
QC:
'https://help.ovhcloud.com/csm/fr-ca-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058257#external-dkim',
MA:
'https://help.ovhcloud.com/csm/fr-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058101#external-dkim',
SN:
'https://help.ovhcloud.com/csm/fr-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058101#external-dkim',
TN:
'https://help.ovhcloud.com/csm/fr-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058101#external-dkim',
WE:
'https://help.ovhcloud.com/csm/en-ie-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058259#external-dkim',
DEFAULT:
'https://help.ovhcloud.com/csm/en-dns-zone-dkim?id=kb_article_view&sysparm_article=KB0058258#configuring-dkim-for-an-email-solution-outside-of-your-ovhcloud-account',
};

export default {
DKIM_STATUS,
DKIM_STATUS_TEXT,
DKIM_STATUS_CLASS,
DKIM_MODAL_TITLE,
DKIM_PRIMARY_BUTTON_LABEL,
DKIM_SECONDARY_BUTTON_LABEL,
DKIM_CONFIGURATION_GUIDE_NO_OVH,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import {
DKIM_STATUS,
DKIM_STATUS_TEXT,
DKIM_MODAL_TITLE,
DKIM_PRIMARY_BUTTON_LABEL,
DKIM_SECONDARY_BUTTON_LABEL,
DKIM_CONFIGURATION_GUIDE_NO_OVH,
} from './email-domain-dkim.constants';

export default class EmailDomainDkimCtrl {
/* @ngInject */
constructor($translate, WucEmails, coreConfig) {
this.$translate = $translate;
this.WucEmails = WucEmails;
this.DKIM_PRIMARY_BUTTON_LABEL = DKIM_PRIMARY_BUTTON_LABEL;
this.DKIM_SECONDARY_BUTTON_LABEL = DKIM_SECONDARY_BUTTON_LABEL;
this.DKIM_STATUS_TEXT = DKIM_STATUS_TEXT;
this.DKIM_MODAL_TITLE = DKIM_MODAL_TITLE;
this.dkimGuideLinkNoOvh =
DKIM_CONFIGURATION_GUIDE_NO_OVH[coreConfig.getUser().ovhSubsidiary] ||
DKIM_CONFIGURATION_GUIDE_NO_OVH.DEFAULT;
}

$onInit() {
if (!this.dkim.autoconfig) {
this.initContext();
}
}

getPrimaryAction() {
if (
[DKIM_STATUS.ENABLED, DKIM_STATUS.DISABLED].includes(this.dkim.status)
) {
this.isSubmitting = true;
const promise =
this.dkim.status === DKIM_STATUS.DISABLED
? this.WucEmails.enableDkim(this.serviceName)
: this.WucEmails.disableDkim(this.serviceName);
return promise
.then(() => {
return this.goBack(
this.$translate.instant('email_domain_dkim_activation_success'),
'success',
true,
);
})
.catch(({ data }) => {
return this.goBack(
this.$translate.instant('email_domain_dkim_error', {
message: data?.message,
}),
'danger',
);
});
}
return this.goBack();
}

initContext() {
this.selector1NoDomain = {
customerRecord: this.dkim.selectors[0].selectorName,
targetRecord: this.dkim.selectors[0].cname,
};

this.selector1RecordInfos = this.getDkimRecord(1);
this.selector2NoDomain = {
customerRecord: this.dkim.selectors[1].selectorName,
targetRecord: this.dkim.selectors[1].cname,
};

this.selector2RecordInfos = this.getDkimRecord(2);
}

getDkimRecord(index) {
return [
`<b>${this.$translate.instant('email_domain_dkim_cname', {
value: index,
})}</b>: `,
this[`selector${index}NoDomain`].targetRecord,
].join('');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<oui-modal
data-heading="{{ :: $ctrl.DKIM_MODAL_TITLE[$ctrl.dkim.status] | translate }}"
data-primary-label="{{ :: $ctrl.DKIM_PRIMARY_BUTTON_LABEL[$ctrl.dkim.status] | translate }}"
data-primary-action="$ctrl.getPrimaryAction()"
data-on-dismiss="$ctrl.goBack()"
data-secondary-action="$ctrl.goBack()"
data-secondary-label="{{ :: $ctrl.DKIM_SECONDARY_BUTTON_LABEL[$ctrl.dkim.status] | translate }}"
data-primary-disabled="$ctrl.isSubmitting"
>
<p
data-ng-if="$ctrl.dkim.autoconfig"
data-translate="{{ $ctrl.DKIM_STATUS_TEXT[$ctrl.dkim.status] }}"
></p>

<div data-ng-if="!$ctrl.dkim.autoconfig">
<p data-translate="email_domain_dkim_configurate_dns_records_info"></p>

<dl class="dl-horizontal dl-md">
<dt data-translate="email_domain_dkim_text_field"></dt>
<dd>
<span data-ng-bind-html="$ctrl.selector1RecordInfos"></span>
</dd>
<dd>
<span data-ng-bind-html="$ctrl.selector2RecordInfos"></span>
</dd>
</dl>

<p
data-translate="email_domain_dkim_configurate_activation_guide"
data-translate-values="{ url: $ctrl.dkimGuideLinkNoOvh }"
class="mb-0"
></p>
<p data-translate="email_domain_dkim_no_ovhcloud_extra_step"></p>
</div>
</oui-modal>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import angular from 'angular';
import 'angular-translate';
import '@ovh-ux/ui-kit';
import ngTranslateAsyncLoader from '@ovh-ux/ng-translate-async-loader';

import component from './email-domain-dkim.component';
import routing from './email-domain-dkim.routes';

const moduleName = 'ovhManagerEmailDomainDkim';

angular
.module(moduleName, [
ngTranslateAsyncLoader,
'oui',
'pascalprecht.translate',
'ui.router',
])
.component('emailDomainDkimComponent', component)
.config(routing)
.run(/* @ngTranslationsInject:json ./translations */);

export default moduleName;
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('app.email.domain.information.dkim', {
url: '/dkim',
layout: 'modal',
views: {
modal: {
component: 'emailDomainDkimComponent',
},
},
params: {
dkim: null,
},
resolve: {
breadcrumb: () => null,
goBack: /* @ngInject */ ($state, setMessage, serviceName) => (
message,
type = 'success',
reload = false,
) => {
const promise = $state.go(
'app.email.domain.information',
{ productId: serviceName },
{
reload,
},
);

if (message) {
promise.then(() => setMessage(message, type));
}

return promise;
},
setMessage: /* @ngInject */ (Alerter, $timeout) => (message, type) =>
$timeout(() => Alerter.set(`alert-${type}`, message, null), 1000),
serviceName: /* @ngInject */ ($transition$) =>
$transition$.params().productId,
dkim: /* @ngInject */ ($transition$, WucEmails, serviceName) =>
!$transition$.params().dkim
? WucEmails.getDkim(serviceName).then((dkim) => dkim)
: $transition$.params().dkim,
},
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"email_domain_dkim_title_activation": "DKIM aktivieren",
"email_domain_dkim_title_desactivation": "DKIM deaktivieren",
"email_domain_dkim_title_configuration": "DKIM-Konfiguration",
"email_domain_dkim_activate": "Aktivieren",
"email_domain_dkim_deactivate": "Deaktivieren",
"email_domain_dkim_activation": "Ihr DKIM ist konfiguriert, aber nicht aktiviert. Möchten Sie es aktivieren?",
"email_domain_dkim_deactivation": "DKIM ist derzeit für Ihre Domain aktiv. Möchten Sie es deaktivieren? (nicht empfohlen)",
"email_domain_dkim_in_progress": "Für Ihr DKIM wird aktuell ein Vorgang ausgeführt.",
"email_domain_dkim_activation_success": "Die DKIM-Konfiguration wird ausgeführt. Beachten Sie, dass es bis zu 24 Stunden dauern kann, bis die Änderung übernommen wird.",
"email_domain_dkim_error": "Bei der DKIM-Konfiguration ist ein Fehler aufgetreten. {{message}}",
"email_domain_dkim_configurate_dns_records_info": "Für die DKIM-Konfiguration müssen Sie Ihren DNS die folgenden beiden Einträge hinzufügen.",
"email_domain_dkim_text_field": "Textfeld",
"email_domain_dkim_cname": "CNAME {{ value }}",
"email_domain_dkim_configurate_activation_guide": "Weitere Informationen finden Sie in der Dokumentation Ihres Domain-Anbieters. Unterstützung erhalten Sie in unserer <a href=\"{{url}}\" target=\"_blank\">Anleitung</a>.",
"email_domain_dkim_no_ovhcloud_extra_step": "Warten Sie nach der Änderung einige Minuten und klicken Sie auf „Aktivieren“."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"email_domain_dkim_title_activation": "Enable DKIM",
"email_domain_dkim_title_desactivation": "Disable DKIM",
"email_domain_dkim_title_configuration": "DKIM configuration",
"email_domain_dkim_activate": "Enable",
"email_domain_dkim_deactivate": "Disable",
"email_domain_dkim_activation": "Your DKIM is configured but not enabled. Do you want to enable it?",
"email_domain_dkim_deactivation": "DKIM is currently enabled on your domain name. Do you want to disable it? (not recommended)",
"email_domain_dkim_in_progress": "An operation pertaining to your DKIM is currently in progress.",
"email_domain_dkim_activation_success": "DKIM configuration in progress. Please note that the update may take up to 24 hours to propagate.",
"email_domain_dkim_error": "An error has occurred configuring DKIM. {{message}}",
"email_domain_dkim_configurate_dns_records_info": "To configure your DKIM, you will need to add these two records to your DNS",
"email_domain_dkim_text_field": "Text field",
"email_domain_dkim_cname": "CNAME {{ value }}",
"email_domain_dkim_configurate_activation_guide": "Please refer to your domain provider’s documentation. You can find helpful information in our <a href=\"{{url}}\" target=\"_blank\">guide</a>.",
"email_domain_dkim_no_ovhcloud_extra_step": "After modifying it, wait a few minutes, then click “Enable”."
}
Loading

0 comments on commit 3e7198d

Please sign in to comment.