Ejemplo n.º 1
0
        public void ResetForgottenPassword(string username, string passwordCode, string newPassword)
        {
            Condition.Requires(username).IsNotNullOrEmpty();
            Condition.Requires(passwordCode).IsNotNullOrEmpty();
            Condition.Requires(newPassword).IsNotNullOrEmpty();

            _logger.Debug("Calling UserAccountService to reset the forgotten password for the user {0}.", username);

            _resetForgottenPasswordStrategy.ResetForgottenPassword(username, passwordCode, newPassword);
        }
        public void ResetForgottenPassword(string username, string passwordCode, string newPassword)
        {
            var user = _userReadRepository.Get(username);

            var candidate = _candidateReadRepository.Get(user.EntityId);

            if (candidate.LegacyCandidateId == 0)
            {
                // Candidate record does not exist on legacy system, create it now.
                var legacyCandidateId = _legacyCandidateProvider.CreateCandidate(candidate);

                candidate.LegacyCandidateId = legacyCandidateId;

                _candidateWriteRepository.Save(candidate);
            }

            _resetForgottenPasswordStrategy.ResetForgottenPassword(username, passwordCode, newPassword);
        }