Пример #1
0
        public int ConfirmPasswordToken(AppUserConfirmPassRequest req)

        {
            string resetToken = null;
            int    id         = 1;
            bool   success    = false;


            dataProvider.ExecuteNonQuery(
                "AppUser_ConfirmPassword",
                (parameters) =>

            {
                parameters.AddWithValue("@ResetToken", req.ResetToken);
                parameters.Add("@Id", SqlDbType.Int).Direction      = ParameterDirection.Output;
                parameters.Add("@Success", SqlDbType.Bit).Direction = ParameterDirection.Output;
            },

                (parameters) =>

                //setting empty box to be filled when we get the data back from database.

            {
                success = (bool)parameters["@Success"].Value;
            });

            if (success)
            {
                return(id);
            }
            else
            {
                return(2);
            }
        }
Пример #2
0
        public HttpResponseMessage ConfirmPasswordToken(AppUserConfirmPassRequest confirmPassRequest)
        {
            //this needs to call service that goes to data base that make sure the restToken is valid gets the
            if (confirmPassRequest == null)
            {
                ModelState.AddModelError("", " Your reset password has been expired");
            }
            if (!ModelState.IsValid)

            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }


            int userId = appUserService.ConfirmPasswordToken(confirmPassRequest);

            return(Request.CreateResponse(HttpStatusCode.Created, new ItemResponse <int> {
                Item = userId
            }));
        }