53 lines
1.6 KiB
Plaintext
53 lines
1.6 KiB
Plaintext
@page "/access_keys/new"
|
|
@inject Blazored.LocalStorage.ILocalStorageService localStorage;
|
|
@inject DedupClient Client;
|
|
@inject IJSRuntime jsRt;
|
|
|
|
<div id="sb_error" class="snackbar error">Incorrect username or password</div>
|
|
|
|
<p>Note: you won't be able to access the key again, unless you have access to the database.</p>
|
|
|
|
<h1>Create access key</h1>
|
|
<div class="field label border">
|
|
<input type="text" @bind-value="Username">
|
|
<label>Username</label>
|
|
</div>
|
|
<div class="field label border">
|
|
<input type="password" @bind-value="Password">
|
|
<label>Password</label>
|
|
</div>
|
|
<div class="field label border">
|
|
<input type="text" @bind-value="DeviceName">
|
|
<label>Device Name</label>
|
|
</div>
|
|
<button @onclick="LoginAsync">Login</button>
|
|
|
|
|
|
<div class="field label border">
|
|
<input type="text" @bind-value="_AccessKey" readonly>
|
|
<label>Access Key</label>
|
|
</div>
|
|
|
|
<a href="/access_keys" class="button">Done</a>
|
|
|
|
@code {
|
|
public string Username {get;set;}="";
|
|
public string Password {get;set;}="";
|
|
|
|
public string DeviceName {get;set;}=$"New Access Key {DateTime.Now.ToShortDateString()} {DateTime.Now.ToShortTimeString()}";
|
|
|
|
public string _AccessKey {get;set;}="";
|
|
|
|
public async Task LoginAsync()
|
|
{
|
|
var res=await Client.LoginAsync(Username,Password,DeviceName);
|
|
if(res.Success)
|
|
{
|
|
_AccessKey=res.Key;
|
|
}
|
|
else
|
|
{
|
|
await jsRt.InvokeVoidAsync("ui","#sb_error");
|
|
}
|
|
}
|
|
} |