Пример #1
0
        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);
        }
Пример #2
0
 private ForgottenPassword FindPasswordResetRequest(Guid key)
 {
     return(ForgottenPasswords.FirstOrDefault(x => x.Key == key));
 }