<InputText class="form-control border-0 text-white" type="password" name="Password" placeholder="Password" @oninput="@((ui) => {Model.Password = ui.Value.ToString();})" @bind-Value="Model.Password" />
@oninput="@((ui) => {Model.Password = ui.Value.ToString();})"
public class LoginModelValidation : AbstractValidator<LoginModel>
{
public LoginModelValidation()
{
RuleFor(p => p.Email).NotEmpty().WithMessage("You must enter a email address");
RuleFor(x => x.Email).EmailAddress().WithMessage("Please enter valid an email");
RuleFor(_ => _.Password).NotEmpty().WithMessage("Your password cannot be empty");
RuleFor(_ => _.Password).MinimumLength(6).WithMessage("Your password length must be at least 6.");
RuleFor(_ => _.Password).MaximumLength(16).WithMessage("Your password length must not exceed 16.");
RuleFor(_ => _.Password).Matches(@"[A-Z]+").WithMessage("Your password must contain at least one uppercase letter.");
RuleFor(_ => _.Password).Matches(@"[a-z]+").WithMessage("Your password must contain at least one lowercase letter.");
RuleFor(_ => _.Password).Matches(@"[0-9]+").WithMessage("Your password must contain at least one number.");
RuleFor(_ => _.Password).Matches(@"[\@\!\?\*\.]+").WithMessage("Your password must contain at least one (@!? *.).");
}
}
Каким образом получение токена у вас может завершиться после получения списка пользователей - тоже загадка.
- ок, а вопрос тогда в чем?
builder.WebHost.UseUrls("http://localhost:5210", "https://localhost:7151");
using allinoneapi.Controllers;
using allinoneapi.Data;
using allinoneapi.Models;
using Microsoft.EntityFrameworkCore;
using System.Net;
using System.Text.Json.Serialization;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
//builder.Services.AddDbContext<allinoneapiContext>(options =>
//options.UseSqlServer(builder.Configuration.GetConnectionString("allinoneapiContext"), op =>
// op.CommandTimeout(60)
//));
builder.Services.AddDbContext<allinoneapiContext>();
//builder.Services.AddHttpsRedirection();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseHsts();
// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI();
//builder.WebHost.UseUrls("http://localhost:5210", "https://localhost:7151");
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.UseRouting();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
app.Run();
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\allinoneapi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 6E110A25-9375-4BBC-830A-D7B26DF30FBD-->