1
0
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:
aj-rosado
2024-06-21 13:56:43 +01:00
committed by GitHub
parent de56461b97
commit f275b2567d
2 changed files with 73 additions and 0 deletions

View File

@ -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)