1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

Fixes: #1101 - Fixed ModelValidators and validation methods (#1242)

* Extend StringLength attributes for emails to 256 char

* Modified validations to check email lengths > 256
This commit is contained in:
Daniel James Smith 2021-03-25 19:21:23 +01:00 committed by GitHub
parent 584d3e771c
commit e6902179f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 17 additions and 17 deletions

View File

@ -27,9 +27,9 @@ namespace Bit.Core.Models.Api.Public
yield return new ValidationResult($"Email is not valid.",
new string[] { nameof(Email) });
}
else if (Email.Length > 50)
else if (Email.Length > 256)
{
yield return new ValidationResult($"Email is longer than 50 characters.",
yield return new ValidationResult($"Email is longer than 256 characters.",
new string[] { nameof(Email) });
}
}

View File

@ -66,7 +66,7 @@ namespace Bit.Core.Models.Api.Public
/// </summary>
/// <example>jsmith@example.com</example>
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
/// <summary>
/// External identifier for reference or linking this member to another system, such as a user directory.

View File

@ -6,7 +6,7 @@ namespace Bit.Core.Models.Api
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
}
}

View File

@ -7,7 +7,7 @@ namespace Bit.Core.Models.Api
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string NewEmail { get; set; }
[Required]
[StringLength(300)]

View File

@ -6,7 +6,7 @@ namespace Bit.Core.Models.Api
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string NewEmail { get; set; }
[Required]
[StringLength(300)]

View File

@ -6,7 +6,7 @@ namespace Bit.Core.Models.Api
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
}
}

View File

@ -7,7 +7,7 @@ namespace Bit.Core.Models.Api
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
}
}

View File

@ -14,7 +14,7 @@ namespace Bit.Core.Models.Api
public string Name { get; set; }
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
[Required]
[StringLength(1000)]

View File

@ -7,7 +7,7 @@ namespace Bit.Core.Models.Api.Request
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
[Required]
public Enums.EmergencyAccessType? Type { get; set; }

View File

@ -7,7 +7,7 @@ namespace Bit.Core.Models.Api
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
public Installation ToInstallation()

View File

@ -42,7 +42,7 @@ namespace Bit.Core.Models.Api
public class User : IValidatableObject
{
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
public bool Deleted { get; set; }
[Required]

View File

@ -15,7 +15,7 @@ namespace Bit.Core.Models.Api
[StringLength(50)]
public string BusinessName { get; set; }
[Required]
[StringLength(50)]
[StringLength(256)]
[EmailAddress]
public string BillingEmail { get; set; }
public PlanType PlanType { get; set; }

View File

@ -16,7 +16,7 @@ namespace Bit.Core.Models.Api
public string Identifier { get; set; }
[EmailAddress]
[Required]
[StringLength(50)]
[StringLength(256)]
public string BillingEmail { get; set; }
public Permissions Permissions { get; set; }

View File

@ -38,9 +38,9 @@ namespace Bit.Core.Models.Api
yield return new ValidationResult($"Email #{i + 1} is not valid.",
new string[] { nameof(Emails) });
}
else if (email.Length > 50)
else if (email.Length > 256)
{
yield return new ValidationResult($"Email #{i + 1} is longer than 50 characters.",
yield return new ValidationResult($"Email #{i + 1} is longer than 256 characters.",
new string[] { nameof(Emails) });
}
}

View File

@ -199,7 +199,7 @@ namespace Bit.Core.Models.Api
{
[Required]
[EmailAddress]
[StringLength(50)]
[StringLength(256)]
public string Email { get; set; }
public User ToUser(User extistingUser)