mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[PM-517] Added validation to maximum and minimum expiry date (#4199)
* Added validation to maximum and minimum expiry date * Updated error text on SendRequestModel * Add tests to ValidateEdit on SendRequestModel
This commit is contained in:
@ -110,6 +110,19 @@ public class SendRequestModel
|
||||
"and try again.");
|
||||
}
|
||||
}
|
||||
if (ExpirationDate.HasValue)
|
||||
{
|
||||
if (ExpirationDate.Value <= nowPlus1Minute)
|
||||
{
|
||||
throw new BadRequestException("You cannot have a Send with an expiration date in the past. " +
|
||||
"Adjust the expiration date and try again.");
|
||||
}
|
||||
if (ExpirationDate.Value > DeletionDate.Value)
|
||||
{
|
||||
throw new BadRequestException("You cannot have a Send with an expiration date greater than the deletion date. " +
|
||||
"Adjust the expiration date and try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Send ToSendBase(Send existingSend, ISendService sendService)
|
||||
|
Reference in New Issue
Block a user