public void AddPasswordResetRequest( ForgottenPassword passwordResetRequest, int expiryLength) { if (passwordResetRequest == null) { throw new DomainValidationException(nameof(passwordResetRequest), "Password Reset Request can not be null."); } if (!passwordResetRequest.IsValid(expiryLength)) { throw new DomainValidationException("Can not add invalid request."); } foreach (var request in ForgottenPasswords.Where(x => !x.Used)) { request.Deactivate(); } ForgottenPasswords.Add(passwordResetRequest); }
private ForgottenPassword FindPasswordResetRequest(Guid key) { return(ForgottenPasswords.FirstOrDefault(x => x.Key == key)); }