-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(account): added the confirm erasure request page (#15442)
ref: MANAGER-16210 Signed-off-by: Omar ALKABOUSS MOUSSANA <[email protected]>
- Loading branch information
1 parent
cb390ff
commit a2bc153
Showing
11 changed files
with
270 additions
and
2 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
packages/manager/modules/account/src/user/gdpr/confirm/confirm-request-erasure.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import controller from './confirm-request-erasure.controller'; | ||
import template from './confirm-request-erasure.html'; | ||
|
||
export default { | ||
bindings: { | ||
publicId: '<', | ||
}, | ||
controller, | ||
template, | ||
}; |
102 changes: 102 additions & 0 deletions
102
packages/manager/modules/account/src/user/gdpr/confirm/confirm-request-erasure.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { | ||
GDPR_FEATURES_CONFIRM_BANNER_CONTAINER, | ||
CONFIRMATION_EMAIL_ERASURE_REQUEST_MESSAGES_MAP, | ||
CONFIRM_ERASURE_REQUEST_MESSAGES_MAP, | ||
} from '../gdpr.constants'; | ||
|
||
export default class ConfirmRequestErasureController { | ||
/* @ngInject */ | ||
constructor( | ||
$translate, | ||
Alerter, | ||
gdprService, | ||
$state, | ||
ssoAuthentication, | ||
$window, | ||
) { | ||
this.Alerter = Alerter; | ||
this.$translate = $translate; | ||
this.gdprService = gdprService; | ||
this.$state = $state; | ||
this.ssoAuthentication = ssoAuthentication; | ||
this.$window = $window; | ||
} | ||
|
||
$onInit() { | ||
this.loading = { | ||
confirm: false, | ||
sendConfirmEmail: false, | ||
}; | ||
|
||
this.model = { | ||
confirm_code: '', | ||
}; | ||
} | ||
|
||
buildErrorMessage(error, mapMessages) { | ||
const requestId = error.headers('x-ovh-queryid'); | ||
return ` | ||
<p>${this.$translate.instant(mapMessages[error.status])}</p> | ||
${ | ||
requestId | ||
? `<p>${this.$translate.instant( | ||
'gdpr_error_identifier', | ||
)} ${requestId}</p>` | ||
: '' | ||
} | ||
`; | ||
} | ||
|
||
sendErasureRequestConfirmationEmail() { | ||
this.Alerter.resetMessage(GDPR_FEATURES_CONFIRM_BANNER_CONTAINER); | ||
this.loading.sendConfirmEmail = true; | ||
this.gdprService | ||
.sendErasureRequestConfirmationEmail(this.publicId) | ||
.then(() => { | ||
this.Alerter.info( | ||
`<strong>${this.$translate.instant( | ||
'gdpr_erasure_confirmation_email_sent_success_title', | ||
)}</strong> ${this.$translate.instant( | ||
'gdpr_erasure_confirmation_email_sent_success_description', | ||
)}`, | ||
GDPR_FEATURES_CONFIRM_BANNER_CONTAINER, | ||
); | ||
}) | ||
.catch((error) => { | ||
this.Alerter.error( | ||
this.buildErrorMessage( | ||
error, | ||
CONFIRMATION_EMAIL_ERASURE_REQUEST_MESSAGES_MAP, | ||
), | ||
GDPR_FEATURES_CONFIRM_BANNER_CONTAINER, | ||
); | ||
}) | ||
.finally(() => { | ||
this.loading.sendConfirmEmail = false; | ||
}); | ||
} | ||
|
||
submitConfirmation() { | ||
if (this.model.confirm_code) { | ||
this.loading.confirm = true; | ||
this.Alerter.resetMessage(GDPR_FEATURES_CONFIRM_BANNER_CONTAINER); | ||
|
||
this.gdprService | ||
.confirmErasure(this.publicId, this.model.confirm_code) | ||
.then(() => this.ssoAuthentication.logout()) | ||
.catch((error) => { | ||
this.Alerter.error( | ||
this.buildErrorMessage(error, CONFIRM_ERASURE_REQUEST_MESSAGES_MAP), | ||
GDPR_FEATURES_CONFIRM_BANNER_CONTAINER, | ||
); | ||
}) | ||
.finally(() => { | ||
this.loading.confirm = false; | ||
}); | ||
} | ||
} | ||
|
||
cancelConfirmation() { | ||
this.$window.location.href = this.$state.href('account.user.gdpr'); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
packages/manager/modules/account/src/user/gdpr/confirm/confirm-request-erasure.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<div> | ||
<div | ||
data-ovh-alert="gdpr-features-confirm.alerts.global" | ||
data-ovh-alert-hide-remove-button="true" | ||
></div> | ||
|
||
<oui-message type="info" class="mb-3"> | ||
<strong data-translate="gdpr_erasure_confirm_banner_title"></strong> | ||
<span data-translate="gdpr_erasure_confirm_banner_description"></span> | ||
</oui-message> | ||
|
||
<oui-tile class="h-100 oui-tile-h-100"> | ||
<div class="d-flex align-items-center mb-4"> | ||
<span | ||
data-translate="gdpr_erasure_confirm_input_code_prompt" | ||
></span> | ||
<oui-button | ||
type="button" | ||
variant="link" | ||
data-on-click="$ctrl.sendErasureRequestConfirmationEmail()" | ||
data-disabled="$ctrl.loading.sendConfirmEmail" | ||
> | ||
<oui-spinner | ||
data-size="s" | ||
ng-if="$ctrl.loading.sendConfirmEmail" | ||
></oui-spinner> | ||
<span | ||
ng-if="!$ctrl.loading.sendConfirmEmail" | ||
data-translate="gdpr_erasure_confirm_resend_code" | ||
></span> | ||
</oui-button> | ||
</div> | ||
|
||
<form name="confirmForm"> | ||
<input | ||
type="text" | ||
class="oui-input oui-input_xl mb-4" | ||
name="confirm_code" | ||
id="confirm_code" | ||
data-ng-model="$ctrl.model.confirm_code" | ||
required | ||
ng-pattern="/^[^{}]*$/" | ||
/> | ||
|
||
<div class="mt-3"> | ||
<oui-button | ||
type="reset" | ||
variant="secondary" | ||
data-disabled="$ctrl.loading.confirm" | ||
data-on-click="$ctrl.cancelConfirmation()" | ||
> | ||
<span | ||
data-translate="gdpr_erasure_confirm_form_cancel" | ||
></span> | ||
</oui-button> | ||
<oui-button | ||
type="submit" | ||
variant="primary" | ||
data-on-click="$ctrl.submitConfirmation()" | ||
data-disabled="confirmForm.$invalid || $ctrl.loading.confirm" | ||
> | ||
<oui-spinner | ||
data-size="s" | ||
ng-if="$ctrl.loading.confirm" | ||
></oui-spinner> | ||
<span | ||
ng-if="!$ctrl.loading.confirm" | ||
data-translate="gdpr_erasure_confirm_form_submit" | ||
></span> | ||
</oui-button> | ||
</div> | ||
</form> | ||
</oui-tile> | ||
</div> |
12 changes: 12 additions & 0 deletions
12
packages/manager/modules/account/src/user/gdpr/confirm/confirm-request-erasure.module.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import routing from './confirm-request-erasure.routing'; | ||
import component from './confirm-request-erasure.component'; | ||
|
||
const moduleName = 'ovhManagerAccountGdprConfirmModule'; | ||
|
||
angular | ||
.module(moduleName, []) | ||
.config(routing) | ||
.component('gdprFeaturesConfirm', component) | ||
.run(/* @ngTranslationsInject:json ./translations */); | ||
|
||
export default moduleName; |
12 changes: 12 additions & 0 deletions
12
packages/manager/modules/account/src/user/gdpr/confirm/confirm-request-erasure.routing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default /* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('account.user.gdpr.confirm', { | ||
url: '/:publicId/confirm-request-erasure', | ||
component: 'gdprFeaturesConfirm', | ||
resolve: { | ||
publicId: /* @ngInject */ ($transition$) => | ||
$transition$.params().publicId, | ||
breadcrumb: /* @ngInject */ ($translate) => | ||
$translate.instant('gdpr_erasure_confirm_title'), | ||
}, | ||
}); | ||
}; |
22 changes: 22 additions & 0 deletions
22
packages/manager/modules/account/src/user/gdpr/confirm/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'oclazyload'; | ||
|
||
const moduleName = 'ovhManagerAccountGdprConfirmModuleLazyLoading'; | ||
|
||
angular | ||
.module(moduleName, []) | ||
.config( | ||
/* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('account.user.gdpr.confirm.**', { | ||
url: '/:publicId/confirm-request-erasure', | ||
lazyLoad: ($transition$) => { | ||
const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); | ||
return import('./confirm-request-erasure.module').then((mod) => | ||
$ocLazyLoad.inject(mod.default || mod), | ||
); | ||
}, | ||
}); | ||
}, | ||
) | ||
.run(/* @ngTranslationsInject:json ./translations */); | ||
|
||
export default moduleName; |
9 changes: 9 additions & 0 deletions
9
packages/manager/modules/account/src/user/gdpr/confirm/translations/Messages_fr_FR.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"gdpr_erasure_confirm_title": "Confirmer la demande", | ||
"gdpr_erasure_confirm_banner_title": "Attention, après confirmation vous serez déconnecté et vous n’aurez plus accès au compte supprimé.", | ||
"gdpr_erasure_confirm_banner_description": "La clôture du compte met définitivement fin à son fonctionnement. À défaut, une demande d’assistance sera créée et un conseiller reviendra vers vous dès que possible.", | ||
"gdpr_erasure_confirm_resend_code": "Récupérer votre code", | ||
"gdpr_erasure_confirm_input_code_prompt": "Renseignez le code que vous avez reçu par e-mail.", | ||
"gdpr_erasure_confirm_form_submit": "Confirmer", | ||
"gdpr_erasure_confirm_form_cancel": "Annuler" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters