1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

view model types

This commit is contained in:
Kyle Spearrin
2018-01-24 11:33:15 -05:00
parent 5557c5b638
commit 7e1c883f03
19 changed files with 299 additions and 118 deletions

View File

@@ -0,0 +1,34 @@
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;
}
}