mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-19 02:51:14 +02:00
subtitle properties
This commit is contained in:
parent
9fe0cfb2d8
commit
b4257b9ff3
@ -4,13 +4,48 @@ import { Card } from '../domain/card';
|
|||||||
|
|
||||||
export class CardView implements View {
|
export class CardView implements View {
|
||||||
cardholderName: string;
|
cardholderName: string;
|
||||||
brand: string;
|
|
||||||
number: string;
|
|
||||||
expMonth: string;
|
expMonth: string;
|
||||||
expYear: string;
|
expYear: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
|
||||||
|
// tslint:disable
|
||||||
|
private _brand: string;
|
||||||
|
private _number: string;
|
||||||
|
private _subTitle: string;
|
||||||
|
// tslint:enable
|
||||||
|
|
||||||
constructor(c?: Card) {
|
constructor(c?: Card) {
|
||||||
// ctor
|
// ctor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get brand(): string {
|
||||||
|
return this._brand;
|
||||||
|
}
|
||||||
|
set brand(value: string) {
|
||||||
|
this._brand = value;
|
||||||
|
this._subTitle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get number(): string {
|
||||||
|
return this._number;
|
||||||
|
}
|
||||||
|
set number(value: string) {
|
||||||
|
this._number = value;
|
||||||
|
this._subTitle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get subTitle(): string {
|
||||||
|
if (this._subTitle == null) {
|
||||||
|
this._subTitle = this.brand;
|
||||||
|
if (this.number != null && this.number.length >= 4) {
|
||||||
|
if (this._subTitle != null && this._subTitle !== '') {
|
||||||
|
this._subTitle += ', ';
|
||||||
|
} else {
|
||||||
|
this._subTitle = '';
|
||||||
|
}
|
||||||
|
this._subTitle += ('*' + this.number.substr(this.number.length - 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this._subTitle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,6 @@ export class CipherView implements View {
|
|||||||
fields: FieldView[];
|
fields: FieldView[];
|
||||||
collectionIds: string[];
|
collectionIds: string[];
|
||||||
|
|
||||||
// tslint:disable-next-line
|
|
||||||
private _subTitle: string;
|
|
||||||
|
|
||||||
constructor(c?: Cipher) {
|
constructor(c?: Cipher) {
|
||||||
if (!c) {
|
if (!c) {
|
||||||
return;
|
return;
|
||||||
@ -45,40 +42,19 @@ export class CipherView implements View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get subTitle(): string {
|
get subTitle(): string {
|
||||||
if (this._subTitle == null) {
|
switch (this.type) {
|
||||||
switch (this.type) {
|
case CipherType.Login:
|
||||||
case CipherType.Login:
|
return this.login.subTitle;
|
||||||
this._subTitle = this.login.username;
|
case CipherType.SecureNote:
|
||||||
break;
|
return this.secureNote.subTitle;
|
||||||
case CipherType.SecureNote:
|
case CipherType.Card:
|
||||||
this._subTitle = null;
|
return this.card.subTitle;
|
||||||
break;
|
case CipherType.Identity:
|
||||||
case CipherType.Card:
|
return this.identity.subTitle;
|
||||||
this._subTitle = this.card.brand;
|
default:
|
||||||
if (this.card.number != null && this.card.number.length >= 4) {
|
break;
|
||||||
if (this._subTitle !== '') {
|
|
||||||
this._subTitle += ', ';
|
|
||||||
}
|
|
||||||
this._subTitle += ('*' + this.card.number.substr(this.card.number.length - 4));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CipherType.Identity:
|
|
||||||
this._subTitle = '';
|
|
||||||
if (this.identity.firstName != null) {
|
|
||||||
this._subTitle = this.identity.firstName;
|
|
||||||
}
|
|
||||||
if (this.identity.lastName != null) {
|
|
||||||
if (this._subTitle !== '') {
|
|
||||||
this._subTitle += ' ';
|
|
||||||
}
|
|
||||||
this._subTitle += this.identity.lastName;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._subTitle;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,7 @@ import { Identity } from '../domain/identity';
|
|||||||
|
|
||||||
export class IdentityView implements View {
|
export class IdentityView implements View {
|
||||||
title: string;
|
title: string;
|
||||||
firstName: string;
|
|
||||||
middleName: string;
|
middleName: string;
|
||||||
lastName: string;
|
|
||||||
address1: string;
|
address1: string;
|
||||||
address2: string;
|
address2: string;
|
||||||
address3: string;
|
address3: string;
|
||||||
@ -22,7 +20,46 @@ export class IdentityView implements View {
|
|||||||
passportNumber: string;
|
passportNumber: string;
|
||||||
licenseNumber: string;
|
licenseNumber: string;
|
||||||
|
|
||||||
|
// tslint:disable
|
||||||
|
private _firstName: string;
|
||||||
|
private _lastName: string;
|
||||||
|
private _subTitle: string;
|
||||||
|
// tslint:enable
|
||||||
|
|
||||||
constructor(i?: Identity) {
|
constructor(i?: Identity) {
|
||||||
// ctor
|
// ctor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get firstName(): string {
|
||||||
|
return this._firstName;
|
||||||
|
}
|
||||||
|
set firstName(value: string) {
|
||||||
|
this._firstName = value;
|
||||||
|
this._subTitle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get lastName(): string {
|
||||||
|
return this._lastName;
|
||||||
|
}
|
||||||
|
set lastName(value: string) {
|
||||||
|
this._lastName = value;
|
||||||
|
this._subTitle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get subTitle(): string {
|
||||||
|
if (this._subTitle == null && (this.firstName != null || this.lastName != null)) {
|
||||||
|
this._subTitle = '';
|
||||||
|
if (this.firstName != null) {
|
||||||
|
this._subTitle = this.firstName;
|
||||||
|
}
|
||||||
|
if (this.lastName != null) {
|
||||||
|
if (this._subTitle !== '') {
|
||||||
|
this._subTitle += ' ';
|
||||||
|
}
|
||||||
|
this._subTitle += this.lastName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._subTitle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,19 +5,37 @@ import { Login } from '../domain/login';
|
|||||||
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
||||||
|
|
||||||
export class LoginView implements View {
|
export class LoginView implements View {
|
||||||
uri: string;
|
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
|
||||||
maskedPassword: string;
|
|
||||||
totp: string;
|
totp: string;
|
||||||
|
|
||||||
// tslint:disable-next-line
|
// tslint:disable
|
||||||
|
private _uri: string;
|
||||||
|
private _username: string;
|
||||||
|
private _password: string;
|
||||||
private _domain: string;
|
private _domain: string;
|
||||||
|
private _maskedPassword: string;
|
||||||
|
// tslint:enable
|
||||||
|
|
||||||
constructor(l?: Login) {
|
constructor(l?: Login) {
|
||||||
// ctor
|
// ctor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get uri(): string {
|
||||||
|
return this._uri;
|
||||||
|
}
|
||||||
|
set uri(value: string) {
|
||||||
|
this._uri = value;
|
||||||
|
this._domain = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get password(): string {
|
||||||
|
return this._password;
|
||||||
|
}
|
||||||
|
set password(value: string) {
|
||||||
|
this._password = value;
|
||||||
|
this._maskedPassword = null;
|
||||||
|
}
|
||||||
|
|
||||||
get domain(): string {
|
get domain(): string {
|
||||||
if (this._domain == null && this.uri != null) {
|
if (this._domain == null && this.uri != null) {
|
||||||
const containerService = (window as any).bitwardenContainerService;
|
const containerService = (window as any).bitwardenContainerService;
|
||||||
@ -31,4 +49,19 @@ export class LoginView implements View {
|
|||||||
|
|
||||||
return this._domain;
|
return this._domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get maskedPassword(): string {
|
||||||
|
if (this._maskedPassword == null && this.password != null) {
|
||||||
|
this._maskedPassword = '';
|
||||||
|
for (var i = 0; i < this.password.length; i++) {
|
||||||
|
this._maskedPassword += '•';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._maskedPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
get subTitle(): string {
|
||||||
|
return this.username;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,8 @@ export class SecureNoteView implements View {
|
|||||||
constructor(n: SecureNote) {
|
constructor(n: SecureNote) {
|
||||||
this.type = n.type;
|
this.type = n.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get subTitle(): string {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user