/// <summary> /// заявка на регистрацию нового пользователя /// </summary> /// <returns></returns> public JsonResult RegistryNewUser([FromBody] object json) { JSEnvelope ret = new JSEnvelope(); try { byte[] bb; string ds = ""; bool capres = false; var Us = JsonConvert.DeserializeObject <User>(json.ToString()); if (Request.HttpContext.Session.Keys.Contains("captcha")) { Request.HttpContext.Session.TryGetValue("captcha", out bb); ds = CoreLogic.GetString(bb); if (Us.captcha == ds) { capres = true; } } if (capres) { var res = CoreLogic.securityManager.RegisterNewUser(Us); ret.ReturnObject = res; ret.Message.MessageText = res; ret.Message.MessageCode = "-1"; } else { ret.Message.IsError = false; ret.Message.MessageText = "Неверно введены символы с картинки."; ret.Message.MessageCode = "-1"; } } catch (E24Exception e) { ret.Message.IsError = true; ret.Message.MessageText = e.Message; ret.Message.MessageCode = e.ExceptionCode.ToString(); } catch (Exception e) { ret.Message.IsError = true; ret.Message.MessageText = e.Message; } return(Json(ret)); }
public IActionResult ChangeFogPassword(string id, string pass, string cacpture) { JSEnvelope ret = new JSEnvelope(); var model = new Model.RememberPasswordModel() { UserId = id }; try { byte[] bb; string ds = ""; bool capres = false; if (Request.HttpContext.Session.Keys.Contains("captcha")) { Request.HttpContext.Session.TryGetValue("captcha", out bb); ds = CoreLogic.GetString(bb); if (cacpture == ds) { capres = true; } } if (capres) { var res = CoreLogic.securityManager.changePass(id, pass); return(View("../Home/Login")); } else { model.Message = "Ошибка! Неверно введены символы с картинки."; return(View("../Home/ChangePassReq", model)); } } catch (E24Exception e) { model.Message = "Ошибка! " + e.Message; return(View("../Home/ChangePassReq", model)); } catch (Exception e) { model.Message = "Ошибка! " + e.Message; return(View("../Home/ChangePassReq", model)); } }