bitwarden-estensione-browser/src/models/view/loginView.ts

35 lines
971 B
TypeScript
Raw Normal View History

2018-01-24 17:33:15 +01:00
import { View } from './view';
import { Login } from '../domain/login';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
export class LoginView implements View {
uri: string;
username: string;
password: string;
maskedPassword: string;
totp: string;
// tslint:disable-next-line
private _domain: string;
constructor(l?: Login) {
// ctor
}
get domain(): string {
if (this._domain == null && this.uri != null) {
const containerService = (window as any).bitwardenContainerService;
if (containerService) {
const platformUtilsService: PlatformUtilsService = containerService.getPlatformUtilsService();
this._domain = platformUtilsService.getDomain(this.uri);
} else {
throw new Error('window.bitwardenContainerService not initialized.');
}
}
return this._domain;
}
}