コード例 #1
0
        public async Task ResetPassword(string token, string password)
        {
            const string message = "Link is invalid or has expired. Please request a new link using the password reset form.";

            MemberPasswordResetRequest request = await _memberRepository.GetPasswordResetRequest(token);

            if (request == null)
            {
                throw new OdkServiceException(message);
            }

            if (request.Expires < DateTime.UtcNow)
            {
                await _memberRepository.DeletePasswordResetRequest(request.Id);

                throw new OdkServiceException(message);
            }

            await UpdatePassword(request.MemberId, password);

            await _memberRepository.DeletePasswordResetRequest(request.Id);
        }