You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.6 KiB
51 lines
1.6 KiB
using Microsoft.AspNetCore.Components;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using TestApp02.Data;
|
|
using System.Web;
|
|
|
|
namespace TestApp02.Pages
|
|
{
|
|
public class LoginModel: ComponentBase
|
|
{
|
|
[Inject] NavigationManager _navigationManager { get; set; }
|
|
|
|
//private BiudAuthService _BiudAuthService;
|
|
[Inject] BiudAuthService _BiudAuthService { get; set; }
|
|
|
|
//public LoginModel(BiudAuthService pBiudAuthService)
|
|
public LoginModel()
|
|
{
|
|
|
|
loginAccountForm= new LoginAccountForm();
|
|
}
|
|
|
|
|
|
public LoginAccountForm loginAccountForm { get; set;}
|
|
|
|
protected async Task OnPostAsync()
|
|
{
|
|
string _uName = encode(loginAccountForm.Username);
|
|
string _uPass = encode(loginAccountForm.Password);
|
|
|
|
_navigationManager.NavigateTo("/login?paramUsername="+ _uName + "¶mPassword=" + _uPass, true);
|
|
}
|
|
|
|
private string encode(string param)
|
|
{
|
|
return HttpUtility.UrlEncode(param);
|
|
}
|
|
}
|
|
|
|
public class LoginAccountForm
|
|
{
|
|
[Required (ErrorMessage = "Необходим логин")]
|
|
[StringLength(30, ErrorMessage = "Допустимая длина логина от 3 до 30 символов ", MinimumLength = 3)]
|
|
public string Username { get; set; }
|
|
|
|
[Required(ErrorMessage = "Необходим пароль")]
|
|
[StringLength(30, ErrorMessage = "Допустимая длина пароля от 3 до 30 символов ", MinimumLength = 3)]
|
|
public string Password { get; set; }
|
|
|
|
}
|
|
}
|