mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
view model types
This commit is contained in:
34
src/models/view/loginView.ts
Normal file
34
src/models/view/loginView.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user