mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
Add warning about 2FA when changing account email (#1186)
* Add warning about 2FA when changing account email * Fix linting * Fix code style and warning wording
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise" ngNativeValidate>
|
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise" ngNativeValidate>
|
||||||
|
<app-callout type="warning" *ngIf="showTwoFactorEmailWarning">
|
||||||
|
{{'changeEmailTwoFactorWarning' | i18n}}
|
||||||
|
</app-callout>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { ToasterService } from 'angular2-toaster';
|
import { ToasterService } from 'angular2-toaster';
|
||||||
@@ -13,15 +14,18 @@ import { UserService } from 'jslib-common/abstractions/user.service';
|
|||||||
import { EmailRequest } from 'jslib-common/models/request/emailRequest';
|
import { EmailRequest } from 'jslib-common/models/request/emailRequest';
|
||||||
import { EmailTokenRequest } from 'jslib-common/models/request/emailTokenRequest';
|
import { EmailTokenRequest } from 'jslib-common/models/request/emailTokenRequest';
|
||||||
|
|
||||||
|
import { TwoFactorProviderType } from 'jslib-common/enums';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-change-email',
|
selector: 'app-change-email',
|
||||||
templateUrl: 'change-email.component.html',
|
templateUrl: 'change-email.component.html',
|
||||||
})
|
})
|
||||||
export class ChangeEmailComponent {
|
export class ChangeEmailComponent implements OnInit {
|
||||||
masterPassword: string;
|
masterPassword: string;
|
||||||
newEmail: string;
|
newEmail: string;
|
||||||
token: string;
|
token: string;
|
||||||
tokenSent = false;
|
tokenSent = false;
|
||||||
|
showTwoFactorEmailWarning = false;
|
||||||
|
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
@@ -29,6 +33,12 @@ export class ChangeEmailComponent {
|
|||||||
private toasterService: ToasterService, private cryptoService: CryptoService,
|
private toasterService: ToasterService, private cryptoService: CryptoService,
|
||||||
private messagingService: MessagingService, private userService: UserService) { }
|
private messagingService: MessagingService, private userService: UserService) { }
|
||||||
|
|
||||||
|
async ngOnInit() {
|
||||||
|
const twoFactorProviders = await this.apiService.getTwoFactorProviders();
|
||||||
|
this.showTwoFactorEmailWarning = twoFactorProviders.data.some(p => p.type === TwoFactorProviderType.Email &&
|
||||||
|
p.enabled);
|
||||||
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
const hasEncKey = await this.cryptoService.hasEncKey();
|
const hasEncKey = await this.cryptoService.hasEncKey();
|
||||||
if (!hasEncKey) {
|
if (!hasEncKey) {
|
||||||
|
|||||||
@@ -899,6 +899,9 @@
|
|||||||
"changeEmail": {
|
"changeEmail": {
|
||||||
"message": "Change Email"
|
"message": "Change Email"
|
||||||
},
|
},
|
||||||
|
"changeEmailTwoFactorWarning": {
|
||||||
|
"message": "Proceeding will change your account email address. It will not change the email address used for two-factor authentication. You can change this email address in the Two-Step Login settings."
|
||||||
|
},
|
||||||
"newEmail": {
|
"newEmail": {
|
||||||
"message": "New Email"
|
"message": "New Email"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user