mirror of
https://github.com/bitwarden/jslib
synced 2025-12-21 02:33:37 +00:00
* add autofill on page load props to models and view For new per-login autofill on page load settings * filter and cache ciphers per autofill setting Used by the new autofill on page load feature to identify matching ciphers and filter according to their autofill setting * fix null check on array * fix linting and style errors * change cacheKey to avoid collision with real url * Fix linting, set default value for aopl-options * Fix linting * update UI * Remove autofillOnPageLoad from export * Change enum to boolean * Add storage key for autofillOnPageLoad default * fix style
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { LoginUriView } from './loginUriView';
|
|
import { View } from './view';
|
|
|
|
import { Utils } from '../../misc/utils';
|
|
import { Login } from '../domain/login';
|
|
|
|
export class LoginView implements View {
|
|
username: string = null;
|
|
password: string = null;
|
|
passwordRevisionDate?: Date = null;
|
|
totp: string = null;
|
|
uris: LoginUriView[] = null;
|
|
autofillOnPageLoad: boolean = null;
|
|
|
|
constructor(l?: Login) {
|
|
if (!l) {
|
|
return;
|
|
}
|
|
|
|
this.passwordRevisionDate = l.passwordRevisionDate;
|
|
this.autofillOnPageLoad = l.autofillOnPageLoad;
|
|
}
|
|
|
|
get uri(): string {
|
|
return this.hasUris ? this.uris[0].uri : null;
|
|
}
|
|
|
|
get maskedPassword(): string {
|
|
return this.password != null ? '••••••••' : null;
|
|
}
|
|
|
|
get subTitle(): string {
|
|
return this.username;
|
|
}
|
|
|
|
get canLaunch(): boolean {
|
|
return this.hasUris && this.uris.some(u => u.canLaunch);
|
|
}
|
|
|
|
get hasTotp(): boolean {
|
|
return !Utils.isNullOrWhitespace(this.totp);
|
|
}
|
|
|
|
get launchUri(): string {
|
|
if (this.hasUris) {
|
|
const uri = this.uris.find(u => u.canLaunch);
|
|
if (uri != null) {
|
|
return uri.launchUri;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
get hasUris(): boolean {
|
|
return this.uris != null && this.uris.length > 0;
|
|
}
|
|
}
|