1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

Password reprompt (#1784)

* Add support for password reprompt

* Rename passwordPrompt to reprompt.

* Move showPasswordDialog to paltformutils

* Fix swal2 validation error styling

* Group imports

* Update src/_locales/en/messages.json

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
This commit is contained in:
Oscar Hinton
2021-05-03 20:56:38 +02:00
committed by GitHub
parent 2c58dbb344
commit cdc71dd661
14 changed files with 179 additions and 30 deletions

View File

@@ -14,12 +14,11 @@ import { CipherView } from 'jslib/models/view/cipherView';
import { EventService } from 'jslib/abstractions/event.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PasswordRepromptService } from 'jslib/abstractions/passwordReprompt.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { TotpService } from 'jslib/abstractions/totp.service';
import { UserService } from 'jslib/abstractions/user.service';
import { PopupUtilsService } from '../services/popup-utils.service';
@Component({
selector: 'app-action-buttons',
templateUrl: 'action-buttons.component.html',
@@ -35,7 +34,8 @@ export class ActionButtonsComponent {
constructor(private toasterService: ToasterService, private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService, private eventService: EventService,
private totpService: TotpService, private userService: UserService) { }
private totpService: TotpService, private userService: UserService,
private passwordRepromptService: PasswordRepromptService) { }
async ngOnInit() {
this.userHasPremiumAccess = await this.userService.canAccessPremium();
@@ -46,6 +46,10 @@ export class ActionButtonsComponent {
}
async copy(cipher: CipherView, value: string, typeI18nKey: string, aType: string) {
if (this.passwordRepromptService.protectedFields().includes(aType) && !await this.passwordRepromptService.showPasswordPrompt()) {
return;
}
if (value == null || aType === 'TOTP' && !this.displayTotpCopyButton(cipher)) {
return;
} else if (value === cipher.login.totp) {