mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 07:06:34 +00:00
[AZ-200] Drop email length rule
Made-with: Cursor
This commit is contained in:
@@ -15,7 +15,7 @@ public class RegisterUserValidator : AbstractValidator<RegisterUserRequest>
|
|||||||
public RegisterUserValidator()
|
public RegisterUserValidator()
|
||||||
{
|
{
|
||||||
RuleFor(r => r.Email)
|
RuleFor(r => r.Email)
|
||||||
.MinimumLength(8).WithErrorCode(ExceptionEnum.EmailLengthIncorrect.ToString()).WithMessage("Email address should be at least 8 characters.")
|
.NotEmpty().WithErrorCode(ExceptionEnum.EmailLengthIncorrect.ToString()).WithMessage("Email address is required.")
|
||||||
.EmailAddress().WithErrorCode(ExceptionEnum.WrongEmail.ToString()).WithMessage("Email address is not valid.");
|
.EmailAddress().WithErrorCode(ExceptionEnum.WrongEmail.ToString()).WithMessage("Email address is not valid.");
|
||||||
|
|
||||||
RuleFor(r => r.Password)
|
RuleFor(r => r.Password)
|
||||||
|
|||||||
@@ -161,14 +161,14 @@ public sealed class UserManagementTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Registration_rejects_short_email_with_400()
|
public async Task Registration_rejects_empty_email_with_400()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
using var client = _fixture.CreateAuthenticatedClient(_fixture.AdminToken);
|
using var client = _fixture.CreateAuthenticatedClient(_fixture.AdminToken);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
using var response = await client.PostAsync("/users",
|
using var response = await client.PostAsync("/users",
|
||||||
new { email = "ab@c.de", password = "ValidPass123", role = 10 });
|
new { email = "", password = "ValidPass123", role = 10 });
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
response.StatusCode.Should().Be(HttpStatusCode.BadRequest);
|
response.StatusCode.Should().Be(HttpStatusCode.BadRequest);
|
||||||
|
|||||||
Reference in New Issue
Block a user