U.U.F.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. Namespace.register("U.U.F"); //用户找回帐号
  2. //#region 切换找回方式
  3. U.U.F.FindPassword = function () {
  4. var _parent = $("#UD_SYC"); //登录注册框
  5. _parent.Center(); //登录注册框居中
  6. var _child = _parent.Child(); //获取登录注册找回密码的div
  7. _child[1].style.display = "none"; //隐藏注册
  8. _child[2].style.display = "none"; //隐藏登录
  9. _child[3].style.display = "block"; //显示找回密码
  10. // $("div", _child[0])[2].innerHTML = "找回密码";
  11. $("div", _child[0])[2].innerHTML = "找回密码";
  12. U.UI.Form({ title: "", max: false, min: false, id: "UD_SYC_Pop", content: _parent[0], style: { width: "360px", "height": "505px" }, hst: { style: { padding: "0"}} });
  13. //头部设置内容
  14. var _head = $(_child[0]).childg()[1];
  15. $(_head).addAttrArray({
  16. innerHTML: "", //通过密保找回密码或 通过<span onclick='U.U.F.QHZHFS(this);'>邮箱找回</div>
  17. onclick: null,
  18. "className": "",
  19. title: ""
  20. });
  21. var _input = $("input", _child[3])[0];
  22. _input.focus();
  23. U.U.F.CKMB($(_child[3]).Child()[1], 0, []);
  24. }
  25. //切换找回的方式,邮箱,密保,手机切换修改位置。
  26. U.U.F.QHZHFS = function (UDOD, UTF) {
  27. var _UDID,
  28. _UDPD = $(UDOD).parentg(2),
  29. _UDCD = _UDPD.Child()[1],
  30. _UDAD = $(_UDCD).Child(),
  31. _UTF = UTF != null ? UTF : UDOD.innerText == " 邮箱找回" ? _UAE = ["密保找回", "邮箱", [U.U.F.YXZHMM, [_UDAD[0]]], "text"] : _UAE = ["邮箱找回", "密保", [U.U.F.SDLMB, [_UDAD[0]]], "password"];
  32. for (var i = 0; i < $(".UD_SYCOBT span").length; i++) { $(".UD_SYCOBT span")[i].className = '' };
  33. _UAE[3] == 'text' ? $(".UD_SYCOBT span")[1].className = 'UD_Span_Hover' : $(".UD_SYCOBT span")[0].className = 'UD_Span_Hover';
  34. // [_UTF ? 0 : 1]
  35. // _UDPD.find("span")[0].innerText = "通过" + _UAE[1] + "找回密码或 通过";
  36. _UDMD = _UDPD.parentg().childg(0)[1];
  37. // _UDMD = $(_UDMD).Child()[1].innerHTML = _UAE[1] + "找回";
  38. // UDOD.innerText = _UAE[0];
  39. _UDPD.find(".UD_SYCOCTR")[1].innerText = _UAE[1];
  40. _UDPD.find("i")[1].innerText = "请输入" + _UAE[1];
  41. (_UDCD = _UDPD.Child()[2]).onclick = U.M.apply(_UDCD, [_UAE[2]]);
  42. _UDCD = _UDPD.find("input"); _UDID = _UDCD[1];
  43. if (_UDID.type != _UAE[3]) {
  44. _UDID = $$("input", { "type": _UAE[3], "onblur": _UDID.onblur, "onfocus": _UDID.onfocus, "onkeyup": _UDID.onkeyup }, _UDID.parentNode, _UDID);
  45. $(_UDCD[1]).remove();
  46. };
  47. _UDAD[0].style.display = "block";
  48. _UDAD[1].style.display = "none";
  49. _UDCD[0].focus();
  50. return _UAE;
  51. }
  52. //提示限制
  53. U.U.F.YXMBTSXZ = function (UDOD) {
  54. var _UDE = [{ color: "", "textAlign": "left", "marginRight": "0px" }, { color: "red", "textAlign": "right", "marginRight": "15px"}];
  55. if (UDOD.type == "text") {
  56. if (!UDOD.value) {
  57. U.U.R.UET(UDOD, [_UDE[0], "请输入邮箱"]);
  58. }
  59. else if (!U.MS.Email.test(UDOD.value)) { U.U.R.UET(UDOD, [_UDE[1], "邮箱格式错误"]); }
  60. else { return true; } return false;
  61. } //邮箱输入限制
  62. else { return U.U.R.IRP(UDOD, _UDE, "请输入密保"); } //密保输入限制 $("i", UDOD.parentNode)[0].style.display = "block";
  63. }
  64. //#endregion
  65. //#region 密保找回
  66. /**
  67. * 查看密保区域
  68. *
  69. * @param {element} 找回密码元素
  70. * @param {int} UCB为回调函数
  71. * @returns {array} 是否登录
  72. */
  73. U.U.F.CKMB = function (UDOD, UTF, UDE) {
  74. var i, _UDAD = $(UDOD).Child(), //找回密码区域元素
  75. _UDPD = $(UDOD).Parent(), //整体元素
  76. _UDE = [[U.U.F.SDLMB, (UDE)], [U.U.F.SDLMBMM, (UDE)]]; //密码设置 邮箱设置回调
  77. UDE.push(_UDAD[UTF]);
  78. for (i = 0; i < _UDAD.length; i++) {//填写密码 通过密保找回
  79. _UDAD[i].style.display = i == UTF ? "block" : "none";
  80. }
  81. _UDAD = $("input", _UDAD[UTF]);
  82. i = _UDAD.length;
  83. while (i--) { //设置页面查看
  84. _UDAD[i].value = "";
  85. _UDAD[i].focus();
  86. (i) && (_UDAD[i].blur());
  87. }
  88. _UDCD = $(_UDPD).Child()[2]; if (UTF) { _UDCD.onclick = U.M.apply(_UDCD, [_UDE[UTF]]); } else { return U.U.F.QHZHFS($("span", _UDPD)[1], 0); } //页面设置
  89. }
  90. //密保设置
  91. U.U.F.SDLMB = function (UDOD) {
  92. var _UDID = $("input", UDOD),
  93. _UN = _UDID[0].value,
  94. _UM = _UDID[1].value;
  95. if (U.U.F.SRXZ($(UDOD).Child()[0]) && U.U.F.YXMBTSXZ(_UDID[1])) {//密保异步
  96. //#Error 这里是密保,但数据库是安全问题,需要访问后台认证,参数为用户id,和保护密码
  97. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "SetPasswordProtect", _UM], U.U.F.AsynSDLMB, ["", UDOD, _UN, _UM, _UDID]);
  98. }
  99. }
  100. //密保设置异步
  101. U.U.F.AsynSDLMB = function (r) {
  102. var _USV = ["", { "color": "", "textAlign": "", "marginRight": "", "display": ""}],
  103. context = r.context,
  104. _UDOD = context[1].parentNode,
  105. _UN = context[2],
  106. _UM = context[3],
  107. _UDID = context[4],
  108. _UDTD = $(_UDID[1]).Parent();
  109. r = r.value[0];
  110. if (r) {
  111. _UDOD = U.U.F.CKMB(_UDOD, 1, [r, _UN, _UM]);
  112. }
  113. else {
  114. _USV[0] = "输入密保错误";
  115. U.Ut.AddObj(_USV[1], { "color": "red", "textAlign": "right", "marginRight": "15px", "display": "block" });
  116. }
  117. U.U.R.UET(_UDTD, [_USV[1], _USV[0]]); //密保设置 //样式查看
  118. }
  119. //新密码设置
  120. U.U.F.SDLMBMM = function (userid, UN, UM, UDOD) {
  121. var i,
  122. _UDSD = this,
  123. _UDAD = $("input", UDOD),
  124. _UDV = _UDAD[1].value,
  125. _UDPD = $(UDOD).Parent(2);
  126. for (i = 0; i < _UDAD.length; i++) { (_UDAD[i].value == "") && (_UDAD[i].focus()); } //需要填写空处
  127. if (_UDAD[0].value != _UDV || !U.MS.PassWord.test(_UDV)) { _UDAD[1].onblur(); } //设置输入不正确
  128. else { //修改密码中
  129. _UDSD.innerText = "等待审核...";
  130. //#Error 安全问题暂时不做
  131. U.A.Request(US.Auth, ["ModifyUserPasswordSecurityAnswer", userid, UM, _UDV], U.U.F.AsynSDLMBMM, ["", _UDPD, _UDSD]);
  132. }
  133. }
  134. //新密码设置异步
  135. U.U.F.AsynSDLMBMM = function (r) {
  136. var context = r.context,
  137. _UDTD = context[2];
  138. r = r.value;
  139. _UDTD.innerText = "确定提交";
  140. (r) && (U.U.L.SDL(3), U.Alert("设置成功,请登录"));
  141. }
  142. //#endregion
  143. //#region 通过邮箱找回
  144. //通过邮箱找回
  145. U.U.F.YXZHMM = function (UDOD) {
  146. var _UDID = $("input", UDOD),
  147. _UN = _UDID[0].value,
  148. _UEM = _UDID[1].value;
  149. if (U.U.F.SRXZ(UDOD) && U.U.F.YXMBTSXZ(_UDID[1])) { //发送邮箱获取
  150. U.A.Request(US.Auth, ["FindPasswordByEmail", _UN, _UEM], U.U.F.AsynYXZHMM, [""]);
  151. }
  152. }
  153. //通过邮箱找回
  154. U.U.F.AsynYXZHMM = function (r) {
  155. var context = r.context;
  156. r = r.value;
  157. (r == "true") && (U.U.L.SDL(3), r = 2); //返回登录页面
  158. U.Alert(["您输入的账号不存在", "邮箱账号不匹配", "也发送信息,请关注邮箱"][r] + ",请重新输入!");
  159. }
  160. //#endregion
  161. //输入限制
  162. U.U.F.SRXZ = function (UDOD, UDE) {
  163. var i, _UTF = true,
  164. _UDAD = $("input", UDOD); UDE = UDE || [];
  165. for (i = 0; i < _UDAD.length; i++) {
  166. (!_UDAD[i].value.isStrNull()) && (_UTF = false, _UDAD[i].focus());
  167. }
  168. return _UTF;
  169. }