コード例 #1
0
        public ActionResult RecoverPassword([FromBody] RecoverPasswordModel model)
        {
            if (model == null ||
                string.IsNullOrWhiteSpace(model.Password) ||
                string.IsNullOrWhiteSpace(model.Token))
            {
                return(CreateResponse("None of the parameters can be null."));
            }

            Validator validator = new Validator();

            List <string> passwordErrors = validator.IsValidPassword(model.Password);

            if (passwordErrors.Count() > 0)
            {
                return(CreateResponse(string.Join("\n", passwordErrors)));
            }

            DataResult <RecoveryRequest> dr = userCore.Recovery(model.Password, model.Token);

            return(CreateResponse(success: dr.Success));
        }