コード例 #1
0
        // SingleData<GeneralKvPair<long, int>> request

        //public async Task<StatusData<string>> ResetPassword(string resetPasswordCode, string newpassword)
        //{
        //    var response = new StatusData<string> { Status = SystemDbStatus.Updated };

        //    var user = await Task.Factory.StartNew(() => Client.UserService.resetPassword(resetPasswordCode, newpassword)).ConfigureAwait(false);
        //    if (user == null)
        //    {
        //        response.Status = SystemDbStatus.NotFound;
        //        return response;
        //    }
        //    response.Status = (SystemDbStatus)user.DbStatusCode;
        //    response.Message = user.DbStatusMsg;
        //    return response;
        //}

        public async Task<StatusData<BaseInfoResponse>> ResetPassword(ResetPasswordRequest request)
        {
            var response = new StatusData<BaseInfoResponse> { Status = SystemDbStatus.NotFound };

            var user = await Task.Factory.StartNew(() => Client.UserService.resetPassword(request.RequestCode, request.Password)).ConfigureAwait(false);
            if (user == null)
                return response;

            response.Status = (SystemDbStatus)user.DbStatusCode;
            response.Message = user.DbStatusMsg;

            if (response.Status.IsOperationSuccessful())
            {
                var result = await Task.Factory.StartNew(() => Client.UserService.getUserInfo(request.UserName, null)).ConfigureAwait(false);

                if (result.UserId > 0)
                {
                    var uInfo = new BaseInfoResponse
                    {
                        UserId = Convert.ToInt32(result.UserId),
                        UserName = result.UserName,
                        UserTypeId = (SystemUserType)result.UserTypeId,
                        Picture = result.Picture,
                        Title = result.Title,
                        Email = result.Email,
                        FirstName = result.FirstName,
                        LastName = result.LastName
                    };
                    response.Data = uInfo;
                }
            }

            return response;
        }
コード例 #2
0
 public Task<StatusData<BaseInfoResponse>> ResetPassword(ResetPasswordRequest request)
 {
     return _jUnitOfWork.Account.ResetPassword(request);
 }