添加项目文件。

This commit is contained in:
SpecialX
2025-05-23 19:03:00 +08:00
parent 6fa7679fd3
commit d36fef2bbb
185 changed files with 13413 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
using TechHelper.Client.HttpRepository;
using Entities.DTO;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
namespace TechHelper.Client.Pages.Author
{
public partial class Login
{
private UserForAuthenticationDto _userForAuth = new UserForAuthenticationDto();
[Inject]
public IAuthenticationClientService AuthenticationService { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
public bool ShowRegistrationErrors { get; set; }
public string Error { get; set; }
public async Task Logining()
{
ShowRegistrationErrors = false;
var result = await AuthenticationService.LoginAsync(_userForAuth);
if (result.Is2StepVerificationRequired)
{
var queryParams = new Dictionary<string, object?>
{
["provider"] = result.Provider,
["Email"] = _userForAuth.Email
};
var uri = NavigationManager.GetUriWithQueryParameters("/twostepverification", queryParams);
NavigationManager.NavigateTo(uri);
}
else if (!result.IsAuthSuccessful)
{
Error = result.ErrorMessage;
ShowRegistrationErrors = true;
}
else
{
NavigationManager.NavigateTo("/");
}
}
}
}