Namespace.register("U.U.F"); //用户找回帐号 //#region 切换找回方式 U.U.F.FindPassword = function () { var _parent = $("#UD_SYC"); //登录注册框 _parent.Center(); //登录注册框居中 var _child = _parent.Child(); //获取登录注册找回密码的div _child[1].style.display = "none"; //隐藏注册 _child[2].style.display = "none"; //隐藏登录 _child[3].style.display = "block"; //显示找回密码 // $("div", _child[0])[2].innerHTML = "找回密码"; $("div", _child[0])[2].innerHTML = "找回密码"; U.UI.Form({ title: "", max: false, min: false, id: "UD_SYC_Pop", content: _parent[0], style: { width: "360px", "height": "505px" }, hst: { style: { padding: "0"}} }); //头部设置内容 var _head = $(_child[0]).childg()[1]; $(_head).addAttrArray({ innerHTML: "", //通过密保找回密码或 通过邮箱找回 onclick: null, "className": "", title: "" }); var _input = $("input", _child[3])[0]; _input.focus(); U.U.F.CKMB($(_child[3]).Child()[1], 0, []); } //切换找回的方式,邮箱,密保,手机切换修改位置。 U.U.F.QHZHFS = function (UDOD, UTF) { var _UDID, _UDPD = $(UDOD).parentg(2), _UDCD = _UDPD.Child()[1], _UDAD = $(_UDCD).Child(), _UTF = UTF != null ? UTF : UDOD.innerText == " 邮箱找回" ? _UAE = ["密保找回", "邮箱", [U.U.F.YXZHMM, [_UDAD[0]]], "text"] : _UAE = ["邮箱找回", "密保", [U.U.F.SDLMB, [_UDAD[0]]], "password"]; for (var i = 0; i < $(".UD_SYCOBT span").length; i++) { $(".UD_SYCOBT span")[i].className = '' }; _UAE[3] == 'text' ? $(".UD_SYCOBT span")[1].className = 'UD_Span_Hover' : $(".UD_SYCOBT span")[0].className = 'UD_Span_Hover'; // [_UTF ? 0 : 1] // _UDPD.find("span")[0].innerText = "通过" + _UAE[1] + "找回密码或 通过"; _UDMD = _UDPD.parentg().childg(0)[1]; // _UDMD = $(_UDMD).Child()[1].innerHTML = _UAE[1] + "找回"; // UDOD.innerText = _UAE[0]; _UDPD.find(".UD_SYCOCTR")[1].innerText = _UAE[1]; _UDPD.find("i")[1].innerText = "请输入" + _UAE[1]; (_UDCD = _UDPD.Child()[2]).onclick = U.M.apply(_UDCD, [_UAE[2]]); _UDCD = _UDPD.find("input"); _UDID = _UDCD[1]; if (_UDID.type != _UAE[3]) { _UDID = $$("input", { "type": _UAE[3], "onblur": _UDID.onblur, "onfocus": _UDID.onfocus, "onkeyup": _UDID.onkeyup }, _UDID.parentNode, _UDID); $(_UDCD[1]).remove(); }; _UDAD[0].style.display = "block"; _UDAD[1].style.display = "none"; _UDCD[0].focus(); return _UAE; } //提示限制 U.U.F.YXMBTSXZ = function (UDOD) { var _UDE = [{ color: "", "textAlign": "left", "marginRight": "0px" }, { color: "red", "textAlign": "right", "marginRight": "15px"}]; if (UDOD.type == "text") { if (!UDOD.value) { U.U.R.UET(UDOD, [_UDE[0], "请输入邮箱"]); } else if (!U.MS.Email.test(UDOD.value)) { U.U.R.UET(UDOD, [_UDE[1], "邮箱格式错误"]); } else { return true; } return false; } //邮箱输入限制 else { return U.U.R.IRP(UDOD, _UDE, "请输入密保"); } //密保输入限制 $("i", UDOD.parentNode)[0].style.display = "block"; } //#endregion //#region 密保找回 /** * 查看密保区域 * * @param {element} 找回密码元素 * @param {int} UCB为回调函数 * @returns {array} 是否登录 */ U.U.F.CKMB = function (UDOD, UTF, UDE) { var i, _UDAD = $(UDOD).Child(), //找回密码区域元素 _UDPD = $(UDOD).Parent(), //整体元素 _UDE = [[U.U.F.SDLMB, (UDE)], [U.U.F.SDLMBMM, (UDE)]]; //密码设置 邮箱设置回调 UDE.push(_UDAD[UTF]); for (i = 0; i < _UDAD.length; i++) {//填写密码 通过密保找回 _UDAD[i].style.display = i == UTF ? "block" : "none"; } _UDAD = $("input", _UDAD[UTF]); i = _UDAD.length; while (i--) { //设置页面查看 _UDAD[i].value = ""; _UDAD[i].focus(); (i) && (_UDAD[i].blur()); } _UDCD = $(_UDPD).Child()[2]; if (UTF) { _UDCD.onclick = U.M.apply(_UDCD, [_UDE[UTF]]); } else { return U.U.F.QHZHFS($("span", _UDPD)[1], 0); } //页面设置 } //密保设置 U.U.F.SDLMB = function (UDOD) { var _UDID = $("input", UDOD), _UN = _UDID[0].value, _UM = _UDID[1].value; if (U.U.F.SRXZ($(UDOD).Child()[0]) && U.U.F.YXMBTSXZ(_UDID[1])) {//密保异步 //#Error 这里是密保,但数据库是安全问题,需要访问后台认证,参数为用户id,和保护密码 U.A.Request(US.CD, [US.DB, "UseStudio_Users", "SetPasswordProtect", _UM], U.U.F.AsynSDLMB, ["", UDOD, _UN, _UM, _UDID]); } } //密保设置异步 U.U.F.AsynSDLMB = function (r) { var _USV = ["", { "color": "", "textAlign": "", "marginRight": "", "display": ""}], context = r.context, _UDOD = context[1].parentNode, _UN = context[2], _UM = context[3], _UDID = context[4], _UDTD = $(_UDID[1]).Parent(); r = r.value[0]; if (r) { _UDOD = U.U.F.CKMB(_UDOD, 1, [r, _UN, _UM]); } else { _USV[0] = "输入密保错误"; U.Ut.AddObj(_USV[1], { "color": "red", "textAlign": "right", "marginRight": "15px", "display": "block" }); } U.U.R.UET(_UDTD, [_USV[1], _USV[0]]); //密保设置 //样式查看 } //新密码设置 U.U.F.SDLMBMM = function (userid, UN, UM, UDOD) { var i, _UDSD = this, _UDAD = $("input", UDOD), _UDV = _UDAD[1].value, _UDPD = $(UDOD).Parent(2); for (i = 0; i < _UDAD.length; i++) { (_UDAD[i].value == "") && (_UDAD[i].focus()); } //需要填写空处 if (_UDAD[0].value != _UDV || !U.MS.PassWord.test(_UDV)) { _UDAD[1].onblur(); } //设置输入不正确 else { //修改密码中 _UDSD.innerText = "等待审核..."; //#Error 安全问题暂时不做 U.A.Request(US.Auth, ["ModifyUserPasswordSecurityAnswer", userid, UM, _UDV], U.U.F.AsynSDLMBMM, ["", _UDPD, _UDSD]); } } //新密码设置异步 U.U.F.AsynSDLMBMM = function (r) { var context = r.context, _UDTD = context[2]; r = r.value; _UDTD.innerText = "确定提交"; (r) && (U.U.L.SDL(3), U.Alert("设置成功,请登录")); } //#endregion //#region 通过邮箱找回 //通过邮箱找回 U.U.F.YXZHMM = function (UDOD) { var _UDID = $("input", UDOD), _UN = _UDID[0].value, _UEM = _UDID[1].value; if (U.U.F.SRXZ(UDOD) && U.U.F.YXMBTSXZ(_UDID[1])) { //发送邮箱获取 U.A.Request(US.Auth, ["FindPasswordByEmail", _UN, _UEM], U.U.F.AsynYXZHMM, [""]); } } //通过邮箱找回 U.U.F.AsynYXZHMM = function (r) { var context = r.context; r = r.value; (r == "true") && (U.U.L.SDL(3), r = 2); //返回登录页面 U.Alert(["您输入的账号不存在", "邮箱账号不匹配", "也发送信息,请关注邮箱"][r] + ",请重新输入!"); } //#endregion //输入限制 U.U.F.SRXZ = function (UDOD, UDE) { var i, _UTF = true, _UDAD = $("input", UDOD); UDE = UDE || []; for (i = 0; i < _UDAD.length; i++) { (!_UDAD[i].value.isStrNull()) && (_UTF = false, _UDAD[i].focus()); } return _UTF; }