lib updates for login view on desktop
This commit is contained in:
parent
b4257b9ff3
commit
e5c1adedff
|
@ -1,23 +1,23 @@
|
|||
export interface TokenService {
|
||||
export abstract class TokenService {
|
||||
token: string;
|
||||
decodedToken: any;
|
||||
refreshToken: string;
|
||||
setTokens(accessToken: string, refreshToken: string): Promise<any>;
|
||||
setToken(token: string): Promise<any>;
|
||||
getToken(): Promise<string>;
|
||||
setRefreshToken(refreshToken: string): Promise<any>;
|
||||
getRefreshToken(): Promise<string>;
|
||||
setTwoFactorToken(token: string, email: string): Promise<any>;
|
||||
getTwoFactorToken(email: string): Promise<string>;
|
||||
clearTwoFactorToken(email: string): Promise<any>;
|
||||
clearToken(): Promise<any>;
|
||||
decodeToken(): any;
|
||||
getTokenExpirationDate(): Date;
|
||||
tokenSecondsRemaining(offsetSeconds?: number): number;
|
||||
tokenNeedsRefresh(minutes?: number): boolean;
|
||||
getUserId(): string;
|
||||
getEmail(): string;
|
||||
getName(): string;
|
||||
getPremium(): boolean;
|
||||
getIssuer(): string;
|
||||
setTokens: (accessToken: string, refreshToken: string) => Promise<any>;
|
||||
setToken: (token: string) => Promise<any>;
|
||||
getToken: () => Promise<string>;
|
||||
setRefreshToken: (refreshToken: string) => Promise<any>;
|
||||
getRefreshToken: () => Promise<string>;
|
||||
setTwoFactorToken: (token: string, email: string) => Promise<any>;
|
||||
getTwoFactorToken: (email: string) => Promise<string>;
|
||||
clearTwoFactorToken: (email: string) => Promise<any>;
|
||||
clearToken: () => Promise<any>;
|
||||
decodeToken: () => any;
|
||||
getTokenExpirationDate: () => Date;
|
||||
tokenSecondsRemaining: (offsetSeconds?: number) => number;
|
||||
tokenNeedsRefresh: (minutes?: number) => boolean;
|
||||
getUserId: () => string;
|
||||
getEmail: () => string;
|
||||
getName: () => string;
|
||||
getPremium: () => boolean;
|
||||
getIssuer: () => string;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export interface TotpService {
|
||||
getCode(keyb32: string): Promise<string>;
|
||||
isAutoCopyEnabled(): Promise<boolean>;
|
||||
export abstract class TotpService {
|
||||
getCode: (keyb32: string) => Promise<string>;
|
||||
isAutoCopyEnabled: () => Promise<boolean>;
|
||||
}
|
||||
|
|
|
@ -57,4 +57,12 @@ export class CipherView implements View {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
get hasAttachments(): boolean {
|
||||
return this.attachments && this.attachments.length > 0;
|
||||
}
|
||||
|
||||
get hasFields(): boolean {
|
||||
return this.fields && this.fields.length > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export class LoginView implements View {
|
|||
get maskedPassword(): string {
|
||||
if (this._maskedPassword == null && this.password != null) {
|
||||
this._maskedPassword = '';
|
||||
for (var i = 0; i < this.password.length; i++) {
|
||||
for (let i = 0; i < this.password.length; i++) {
|
||||
this._maskedPassword += '•';
|
||||
}
|
||||
}
|
||||
|
@ -64,4 +64,16 @@ export class LoginView implements View {
|
|||
get subTitle(): string {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
get domainOrUri(): string {
|
||||
return this.domain != null ? this.domain : this.uri;
|
||||
}
|
||||
|
||||
get isWebsite(): boolean {
|
||||
return this.uri != null && (this.uri.indexOf('http://') > -1 || this.uri.indexOf('https://') > -1);
|
||||
}
|
||||
|
||||
get canLaunch(): boolean {
|
||||
return this.uri != null && this.uri.indexOf('://') > -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ConstantsService } from './constants.service';
|
|||
import { UtilsService } from './utils.service';
|
||||
|
||||
import { StorageService } from '../abstractions/storage.service';
|
||||
import { TokenService as TokenServiceInterface } from '../abstractions/token.service';
|
||||
import { TokenService as TokenServiceAbstraction } from '../abstractions/token.service';
|
||||
|
||||
const Keys = {
|
||||
accessToken: 'accessToken',
|
||||
|
@ -10,7 +10,7 @@ const Keys = {
|
|||
twoFactorTokenPrefix: 'twoFactorToken_',
|
||||
};
|
||||
|
||||
export class TokenService implements TokenServiceInterface {
|
||||
export class TokenService implements TokenServiceAbstraction {
|
||||
token: string;
|
||||
decodedToken: any;
|
||||
refreshToken: string;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConstantsService } from './constants.service';
|
||||
|
||||
import { StorageService } from '../abstractions/storage.service';
|
||||
import { TotpService as TotpServiceInterface } from '../abstractions/totp.service';
|
||||
import { TotpService as TotpServiceAbstraction } from '../abstractions/totp.service';
|
||||
|
||||
const b32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
|
||||
|
@ -10,7 +10,7 @@ const TotpAlgorithm = {
|
|||
hash: { name: 'SHA-1' },
|
||||
};
|
||||
|
||||
export class TotpService implements TotpServiceInterface {
|
||||
export class TotpService implements TotpServiceAbstraction {
|
||||
constructor(private storageService: StorageService) {
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue