This commit is contained in:
parent
325e2f1ee9
commit
08e573d63c
17 changed files with 348 additions and 26 deletions
|
|
@ -3,9 +3,20 @@
|
|||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using Microsoft.Extensions.Options
|
||||
@using WorkTracker.Configuration
|
||||
|
||||
@inject IOptions<AppAuthOptions> AppAuthOptions
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<PageTitle>Change Password</PageTitle>
|
||||
|
||||
@if (!AppAuthOptions.Value.Enabled)
|
||||
{
|
||||
<p>Redirecting...</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h1>Change password</h1>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Error))
|
||||
|
|
@ -26,8 +37,17 @@
|
|||
|
||||
<button type="submit" class="btn btn-primary">Change password</button>
|
||||
</form>
|
||||
}
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
public string? Error { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (!AppAuthOptions.Value.Enabled)
|
||||
{
|
||||
Navigation.NavigateTo("/", forceLoad: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,20 @@
|
|||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using Microsoft.Extensions.Options
|
||||
@using WorkTracker.Configuration
|
||||
|
||||
@inject IOptions<AppAuthOptions> AppAuthOptions
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<PageTitle>Login</PageTitle>
|
||||
|
||||
@if (!AppAuthOptions.Value.Enabled)
|
||||
{
|
||||
<p>Redirecting...</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h1>Login</h1>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Error))
|
||||
|
|
@ -28,6 +39,7 @@
|
|||
|
||||
<button type="submit" class="btn btn-primary">Sign in</button>
|
||||
</form>
|
||||
}
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
|
|
@ -39,6 +51,14 @@
|
|||
[SupplyParameterFromQuery]
|
||||
public string? Username { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (!AppAuthOptions.Value.Enabled)
|
||||
{
|
||||
Navigation.NavigateTo(SafeReturnUrl, forceLoad: true);
|
||||
}
|
||||
}
|
||||
|
||||
private string SafeReturnUrl =>
|
||||
string.IsNullOrWhiteSpace(ReturnUrl) || !Uri.IsWellFormedUriString(ReturnUrl, UriKind.Relative)
|
||||
? "/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue