mirror of
https://github.com/bitwarden/jslib
synced 2025-12-19 01:33:22 +00:00
Dynamic Modals (#417)
* Move backdrop and click handler to modal service since they should not be used in web * Add support for opening modals using ViewContainerRef
This commit is contained in:
28
angular/src/services/passwordReprompt.service.ts
Normal file
28
angular/src/services/passwordReprompt.service.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||
|
||||
import { PasswordRepromptComponent } from '../components/password-reprompt.component';
|
||||
import { ModalService } from './modal.service';
|
||||
|
||||
@Injectable()
|
||||
export class PasswordRepromptService implements PasswordRepromptServiceAbstraction {
|
||||
protected component = PasswordRepromptComponent;
|
||||
|
||||
constructor(private modalService: ModalService) { }
|
||||
|
||||
protectedFields() {
|
||||
return ['TOTP', 'Password', 'H_Field', 'Card Number', 'Security Code'];
|
||||
}
|
||||
|
||||
async showPasswordPrompt() {
|
||||
const ref = this.modalService.open(this.component, {allowMultipleModals: true});
|
||||
|
||||
if (ref == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const result = await ref.onClosedPromise();
|
||||
return result === true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user