diff --git a/src/app/accounts/recover-delete.component.html b/src/app/accounts/recover-delete.component.html new file mode 100644 index 0000000000..22f591640a --- /dev/null +++ b/src/app/accounts/recover-delete.component.html @@ -0,0 +1,27 @@ +
+
+
+

{{'deleteAccount' | i18n}}

+
+
+

{{'deleteRecoverDesc' | i18n}}

+
+ + +
+
+
+ + + {{'cancel' | i18n}} + +
+
+
+
+
+
diff --git a/src/app/accounts/recover-delete.component.ts b/src/app/accounts/recover-delete.component.ts new file mode 100644 index 0000000000..d97bb03346 --- /dev/null +++ b/src/app/accounts/recover-delete.component.ts @@ -0,0 +1,36 @@ +import { Component } from '@angular/core'; +import { Router } from '@angular/router'; + +import { ToasterService } from 'angular2-toaster'; +import { Angulartics2 } from 'angulartics2'; + +import { ApiService } from 'jslib/abstractions/api.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; + +import { DeleteRecoverRequest } from 'jslib/models/request/deleteRecoverRequest'; + +@Component({ + selector: 'app-recover-delete', + templateUrl: 'recover-delete.component.html', +}) +export class RecoverDeleteComponent { + email: string; + formPromise: Promise; + + constructor(private router: Router, private apiService: ApiService, + private analytics: Angulartics2, private toasterService: ToasterService, + private i18nService: I18nService) { + } + + async submit() { + try { + const request = new DeleteRecoverRequest(); + request.email = this.email.toLowerCase(); + this.formPromise = this.apiService.postAccountRecoverDelete(request); + await this.formPromise; + this.analytics.eventTrack.next({ action: 'Started Delete Recovery' }); + this.toasterService.popAsync('success', null, this.i18nService.t('deleteRecoverEmailSent')); + this.router.navigate(['/']); + } catch { } + } +} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index d19914a6a9..91ef5dee53 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -12,6 +12,7 @@ import { AcceptOrganizationComponent } from './accounts/accept-organization.comp import { HintComponent } from './accounts/hint.component'; import { LockComponent } from './accounts/lock.component'; import { LoginComponent } from './accounts/login.component'; +import { RecoverDeleteComponent } from './accounts/recover-delete.component'; import { RecoverTwoFactorComponent } from './accounts/recover-two-factor.component'; import { RegisterComponent } from './accounts/register.component'; import { TwoFactorComponent } from './accounts/two-factor.component'; @@ -77,6 +78,7 @@ const routes: Routes = [ { path: 'accept-organization', component: AcceptOrganizationComponent }, { path: 'recover', pathMatch: 'full', redirectTo: 'recover-2fa' }, { path: 'recover-2fa', component: RecoverTwoFactorComponent, canActivate: [UnauthGuardService] }, + { path: 'recover-delete', component: RecoverDeleteComponent, canActivate: [UnauthGuardService] }, ], }, { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6f08250c64..aaf8b791ed 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -29,6 +29,7 @@ import { AcceptOrganizationComponent } from './accounts/accept-organization.comp import { HintComponent } from './accounts/hint.component'; import { LockComponent } from './accounts/lock.component'; import { LoginComponent } from './accounts/login.component'; +import { RecoverDeleteComponent } from './accounts/recover-delete.component'; import { RecoverTwoFactorComponent } from './accounts/recover-two-factor.component'; import { RegisterComponent } from './accounts/register.component'; import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component'; @@ -207,6 +208,7 @@ import { SearchPipe } from 'jslib/angular/pipes/search.pipe'; PremiumComponent, ProfileComponent, PurgeVaultComponent, + RecoverDeleteComponent, RecoverTwoFactorComponent, RegisterComponent, SearchCiphersPipe, diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 57fac44051..beeee3d554 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -2134,5 +2134,11 @@ }, "learnMore": { "message": "Learn more" + }, + "deleteRecoverDesc": { + "message": "Enter your email address below to recover and delete your account." + }, + "deleteRecoverEmailSent": { + "message": "If your account exists, we've sent you an email with further instructions." } }