Refinements to auth
This commit is contained in:
@@ -9,7 +9,7 @@ namespace WebApp.Authentication
|
||||
{
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> CookieLogin()
|
||||
public async Task<IActionResult> CookieLogin(string email, string password)
|
||||
{
|
||||
// Based on: https://www.codeproject.com/articles/Understanding-authentication-in-Blazor-and-ASP-NET
|
||||
// TODO: Fix this up
|
||||
|
||||
@@ -6,6 +6,39 @@
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
|
||||
<form action="Auth/CookieLogout" method="post">
|
||||
<button type="submit" class="btn btn-primary">Logout</button>
|
||||
</form>
|
||||
<MudText Typo="Typo.h4" GutterBottom="true">Sign In</MudText>
|
||||
|
||||
@* <MudTextField T="string" Value="@("staff@mudblazor.com")" Label="E-mail" Variant="Variant.Outlined" Class="my-6"></MudTextField> *@
|
||||
|
||||
<MudTextField @bind-Value="@Password" Label="Password" Variant="Variant.Outlined" InputType="@PasswordInput" Adornment="Adornment.End" AdornmentIcon="@PasswordInputIcon" OnAdornmentClick="TogglePasswordVisibility" />
|
||||
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<MudCheckBox T="bool" Label="Remember me?" Color="Color.Primary" Class="ml-n1 my-3"></MudCheckBox>
|
||||
<MudLink Href="/pages/authentication/forgot-password">Forgot pwd?</MudLink>
|
||||
</div>
|
||||
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Link="/personal/dashboard" Size="Size.Large" FullWidth="true">Sign In</MudButton>
|
||||
|
||||
@code {
|
||||
string Password { get; set; } = "BMWvBPJXZu";
|
||||
|
||||
bool PasswordVisibility;
|
||||
InputType PasswordInput = InputType.Password;
|
||||
string PasswordInputIcon = Icons.Material.Filled.VisibilityOff;
|
||||
|
||||
void TogglePasswordVisibility()
|
||||
{
|
||||
@if (PasswordVisibility)
|
||||
{
|
||||
PasswordVisibility = false;
|
||||
PasswordInputIcon = Icons.Material.Filled.VisibilityOff;
|
||||
PasswordInput = InputType.Password;
|
||||
}
|
||||
else
|
||||
{
|
||||
PasswordVisibility = true;
|
||||
PasswordInputIcon = Icons.Material.Filled.Visibility;
|
||||
PasswordInput = InputType.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -59,9 +59,7 @@ app.UseAntiforgery();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute("default", "{controller}/{action}");
|
||||
});
|
||||
// Used for AuthController
|
||||
app.MapControllerRoute("default", "{controller}/{action}");
|
||||
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user