mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-01-02 02:58:39 -05:00
33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
@using Microsoft.Extensions.Localization
|
|
@inject DbService DbService
|
|
@inject AuthService AuthService
|
|
@inject NavigationManager NavigationManager
|
|
@inject IStringLocalizerFactory LocalizerFactory
|
|
|
|
<div class="ms-2 items-center hidden lg:flex">
|
|
<button class="p-2 hover:bg-gray-200 rounded-2xl" @onclick="OnLockClick" title="@SharedLocalizer["LockVault"]">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-400" viewBox="0 0 20 20" fill="currentColor">
|
|
<path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
@code {
|
|
private IStringLocalizer SharedLocalizer => LocalizerFactory.Create("SharedResources", "AliasVault.Client");
|
|
|
|
/// <summary>
|
|
/// Lock the database.
|
|
/// </summary>
|
|
private void OnLockClick()
|
|
{
|
|
// Remove encryption key.
|
|
AuthService.RemoveEncryptionKey();
|
|
|
|
// Initialize empty database which removes unencrypted data.
|
|
DbService.InitializeEmptyDatabase();
|
|
|
|
// Redirect to unlock page with SkipWebAuthn parameter set to true.
|
|
NavigationManager.NavigateTo("/unlock/true");
|
|
}
|
|
}
|