added additional options for vault remember password

This commit is contained in:
Aaron Davison 2021-10-18 16:00:17 +13:00
parent f7cab00e4d
commit d82a88bcc6
2 changed files with 18 additions and 3 deletions

View file

@ -3,7 +3,7 @@
h3.m-0 Vault is locked
.ml-auto(ngbDropdown, placement='bottom-right')
button.btn.btn-link(ngbDropdownToggle, (click)='$event.stopPropagation()')
span(*ngIf='rememberFor') Remember for {{rememberFor}} min
span(*ngIf='rememberFor') Remember for {{getRememberForDisplay(rememberFor)}}
span(*ngIf='!rememberFor') Do not remember
div(ngbDropdownMenu)
button.dropdown-item(
@ -12,7 +12,7 @@
button.dropdown-item(
*ngFor='let x of rememberOptions',
(click)='rememberFor = x',
) {{x}} min
) {{getRememberForDisplay(x)}}
.input-group
input.form-control.form-control-lg(

View file

@ -8,7 +8,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
export class UnlockVaultModalComponent {
passphrase: string
rememberFor = 1
rememberOptions = [1, 5, 15, 60]
rememberOptions = [1, 5, 15, 60, 1440, 10080]
@ViewChild('input') input: ElementRef
constructor (
@ -33,4 +33,19 @@ export class UnlockVaultModalComponent {
cancel (): void {
this.modalInstance.close(null)
}
getRememberForDisplay (rememberOption): string {
if (rememberOption >= 1440)
{
return `${Math.round((rememberOption/1440)*10)/10} day`
}
else if (rememberOption >= 60)
{
return `${Math.round((rememberOption/60)*10)/10} hour`
}
else
{
return `${rememberOption} min`
}
}
}