mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-29 07:59:42 +01:00
mask field
This commit is contained in:
parent
145188c005
commit
a3beb04f7e
@ -6,13 +6,9 @@ import { Field } from '../domain/field';
|
||||
|
||||
export class FieldView implements View {
|
||||
name: string;
|
||||
value: string;
|
||||
type: FieldType;
|
||||
|
||||
// tslint:disable
|
||||
private _value: string;
|
||||
private _maskedValue: string;
|
||||
// tslint:enable
|
||||
|
||||
constructor(f?: Field) {
|
||||
if (!f) {
|
||||
return;
|
||||
@ -21,22 +17,7 @@ export class FieldView implements View {
|
||||
this.type = f.type;
|
||||
}
|
||||
|
||||
get value(): string {
|
||||
return this._value;
|
||||
}
|
||||
set value(value: string) {
|
||||
this._value = value;
|
||||
this._maskedValue = null;
|
||||
}
|
||||
|
||||
get maskedValue(): string {
|
||||
if (this._maskedValue == null && this.value != null) {
|
||||
this._maskedValue = '';
|
||||
for (let i = 0; i < this.value.length; i++) {
|
||||
this._maskedValue += '•';
|
||||
}
|
||||
}
|
||||
|
||||
return this._maskedValue;
|
||||
return this.value != null ? '••••••••' : null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user