|
|
@@ -111,7 +111,7 @@ MWF.xDesktop.Authentication = new Class({
|
|
|
});
|
|
|
delete opt.width;
|
|
|
delete opt.height;
|
|
|
- if (this.options.popupStyle_signup) opt.popupStyle = this.options.popupStyle_signup
|
|
|
+ if (this.options.popupStyle_signup) opt.popupStyle = this.options.popupStyle_signup;
|
|
|
var form = new MWF.xDesktop.Authentication.SignUpForm(this, {}, opt, this.popupPara);
|
|
|
form.create();
|
|
|
},
|
|
|
@@ -122,11 +122,22 @@ MWF.xDesktop.Authentication = new Class({
|
|
|
this.fireEvent("postOk", json)
|
|
|
}.bind(this)
|
|
|
});
|
|
|
- if (this.options.popupStyle_password) opt.popupStyle = this.options.popupStyle_password
|
|
|
+ if (this.options.popupStyle_password) opt.popupStyle = this.options.popupStyle_password;
|
|
|
// delete opt.width;
|
|
|
// delete opt.height;
|
|
|
var form = new MWF.xDesktop.Authentication.ResetPasswordForm(this, {}, opt, this.popupPara);
|
|
|
form.create();
|
|
|
+ },
|
|
|
+ openChangePasswordForm: function (options, callback) {
|
|
|
+ var opt = Object.merge(this.popupOptions || {}, options || {}, {
|
|
|
+ onPostOk: function (json) {
|
|
|
+ if (callback) callback(json);
|
|
|
+ this.fireEvent("postOk", json)
|
|
|
+ }.bind(this)
|
|
|
+ });
|
|
|
+ // if (this.options.popupStyle_password) opt.popupStyle = this.options.popupStyle_password;
|
|
|
+ var form = new MWF.xDesktop.Authentication.ChangePasswordForm(this, {}, opt, this.popupPara);
|
|
|
+ form.create();
|
|
|
}
|
|
|
|
|
|
});
|
|
|
@@ -1010,6 +1021,10 @@ MWF.xDesktop.Authentication.LoginForm = new Class({
|
|
|
this.explorer.openResetPasswordForm();
|
|
|
this.close();
|
|
|
},
|
|
|
+ gotoChangePassword : function(){ //密码过期
|
|
|
+ this.explorer.openChangePasswordForm();
|
|
|
+ this.close();
|
|
|
+ },
|
|
|
checkBindStatus: function () {
|
|
|
this.bindStatusInterval = setInterval(function () {
|
|
|
this.actions.checkBindStatus(this.bindMeta, function (json) {
|
|
|
@@ -1064,6 +1079,8 @@ MWF.xDesktop.Authentication.LoginForm = new Class({
|
|
|
this._ok(data, function (json) {
|
|
|
if (json.type === "error") {
|
|
|
if (this.app) this.app.notice(json.message, "error");
|
|
|
+ } else if( json.data.passwordExpired ){ //密码过期
|
|
|
+ this.gotoChangePassword();
|
|
|
} else {
|
|
|
this._close();
|
|
|
if (this.formMaskNode) this.formMaskNode.destroy();
|
|
|
@@ -1583,6 +1600,7 @@ MWF.xDesktop.Authentication.SignUpForm = new Class({
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+//忘记密码
|
|
|
MWF.xDesktop.Authentication.ResetPasswordForm = new Class({
|
|
|
Extends: MPopupForm,
|
|
|
Implements: [Options, Events],
|
|
|
@@ -2035,6 +2053,7 @@ MWF.xDesktop.Authentication.ResetPasswordForm = new Class({
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+//密码过期
|
|
|
MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
Extends: MPopupForm,
|
|
|
Implements: [Options, Events],
|
|
|
@@ -2056,64 +2075,19 @@ MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
},
|
|
|
_createTableContent: function () {
|
|
|
|
|
|
- // "<tr><td styles='formTableTitle' lable='password'></td>" +
|
|
|
- // " <td styles='formTableValue' item='password'></td>" +
|
|
|
- // " <td styles='formTableValue'><div item='passwordStrengthArea'></div></div><div item='passwordTip'></div></td></tr>" +
|
|
|
- // "<tr><td styles='formTableTitle' lable='confirmPassword'></td>" +
|
|
|
- // " <td styles='formTableValue' item='confirmPassword'></td>" +
|
|
|
- // " <td styles='formTableValue' item='confirmPasswordTip'></td></tr>" +
|
|
|
-
|
|
|
- var html =
|
|
|
- "<table width='100%' bordr='0' cellpadding='0' cellspacing='0' styles='formTable'>" +
|
|
|
- "<tr><div><div item='passwordAction'>";
|
|
|
- if (this.codeLogin) {
|
|
|
- html += "</div><div styles='titleSep'></div><div item='codeAction'></div></tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
|
|
|
html += "<table width='100%' bordr='0' cellpadding='0' cellspacing='0' styles='formTable'>" +
|
|
|
- "<tr item='credentialTr'><td styles='formTableValueTop20' item='credential'></td></tr>" +
|
|
|
- "<tr item='passwordTr'><td styles='formTableValueTop20' item='password'></td></tr>";
|
|
|
- if (this.captchaLogin) {
|
|
|
- html += "<tr item='captchaTr'><td styles='formTableValueTop20'>" +
|
|
|
- "<div item='captchaAnswer' style='float:left;'></div><div item='captchaPic' style='float:left;'></div><div item='changeCaptchaAction' style='float:left;'></div>" +
|
|
|
- "</td></tr>";
|
|
|
- }
|
|
|
- if (this.codeLogin) {
|
|
|
- html += "<tr item='codeTr' style='display: none'><td styles='formTableValueTop20'>" +
|
|
|
- " <div item='codeAnswer' style='float:left;'></div>" +
|
|
|
- " <div item='verificationAction' style='float:left;'></div>" +
|
|
|
- " <div item='resendVerificationAction' style='float:left;display:none;'></div>" +
|
|
|
- "</td></tr>";
|
|
|
- }
|
|
|
- html += "<tr><td styles='formTableValueTop20' item='loginAction'></td></tr>" +
|
|
|
- "</table>" +
|
|
|
- "<table width='100%' bordr='0' cellpadding='0' cellspacing='0' styles='formTable'>";
|
|
|
- if (this.signUpMode && this.signUpMode !== "disable") {
|
|
|
- html += "<tr><td><div item='signUpAction'></div><div item='forgetPassword'></div></td></tr>";
|
|
|
- } else {
|
|
|
- html += "<tr><td><div styles='signUpAction'></div><div item='forgetPassword'></div></td></tr>";
|
|
|
- }
|
|
|
- html += "<tr><td styles='formTableValue' item='errorArea'></td></tr>" +
|
|
|
- "<tr><td styles='formTableValue' item='oauthArea'></td></tr>" +
|
|
|
+ "<tr><td styles='formTableValue' item='password'></td></tr>" +
|
|
|
+ "<tr><td styles='formTableValue' item='newPassword'></td>" +
|
|
|
+ "<tr><td styles='formTableValue'><div item='passwordStrengthArea'></div></div><div item='passwordTip'></div></td></tr>" +
|
|
|
+ "<tr><td styles='formTableValue' item='confirmPassword'></td>" +
|
|
|
+ "<tr><td styles='formTableValue' item='confirmPasswordTip'></td></tr>" +
|
|
|
+ "<tr><td styles='formTableValueTop20' item='submitAction'></td></tr>" +
|
|
|
+ "<tr><td><div item='forgetPassword'></div></td></tr>"+
|
|
|
+ "<tr><td styles='formTableValue' item='errorArea'></td></tr>" +
|
|
|
"</table>";
|
|
|
|
|
|
this.formTableArea.set("html", html);
|
|
|
- new Element("div", {
|
|
|
- "styles": this.css.formFooter,
|
|
|
- // "styles": {
|
|
|
- // "text-align": "center",
|
|
|
- // "height": "40px",
|
|
|
- // "line-height": "40px"
|
|
|
- // },
|
|
|
- "text": layout.config.footer || layout.config.systemName
|
|
|
- }).inject(this.formTableArea, "after");
|
|
|
-
|
|
|
-
|
|
|
- if (this.captchaLogin) this.setCaptchaPic();
|
|
|
- this.errorArea = this.formTableArea.getElement("[item=errorArea]");
|
|
|
-
|
|
|
- this.oauthArea = this.formTableArea.getElement("[item=oauthArea]");
|
|
|
|
|
|
MWF.xDesktop.requireApp("Template", "MForm", function () {
|
|
|
this.form = new MForm(this.formTableArea, this.data, {
|
|
|
@@ -2121,41 +2095,14 @@ MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
verifyType: "single", //batch一起校验,或alert弹出
|
|
|
isEdited: this.isEdited || this.isNew,
|
|
|
itemTemplate: {
|
|
|
- credential: {
|
|
|
- text: this.lp.userName,
|
|
|
- defaultValue: this.lp.userName,
|
|
|
- className: "inputUser",
|
|
|
- notEmpty: true,
|
|
|
- defaultValueAsEmpty: true,
|
|
|
- emptyTip: this.lp.inputYourUserName,
|
|
|
- event: {
|
|
|
- focus: function (it) {
|
|
|
- if (this.lp.userName === it.getValue()) it.setValue("");
|
|
|
- if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputActive);
|
|
|
- }.bind(this),
|
|
|
- blur: function (it) {
|
|
|
- if ("" === it.getValue()) it.setValue(this.lp.userName);
|
|
|
- if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputUser);
|
|
|
- }.bind(this),
|
|
|
- keyup: function (it, ev) {
|
|
|
- if (ev.event.keyCode === 13) this.ok();
|
|
|
- }.bind(this)
|
|
|
- },
|
|
|
- onEmpty: function (it) {
|
|
|
- it.getElements()[0].setStyles(this.css.inputEmpty);
|
|
|
- }.bind(this),
|
|
|
- onUnempty: function (it) {
|
|
|
- it.getElements()[0].setStyles(this.css.inputUser);
|
|
|
- }.bind(this)
|
|
|
- },
|
|
|
password: {
|
|
|
- text: this.lp.password,
|
|
|
+ text: this.lp.oldPassword,
|
|
|
type: "password",
|
|
|
defaultValue: "password",
|
|
|
className: "inputPassword",
|
|
|
notEmpty: true,
|
|
|
defaultValueAsEmpty: true,
|
|
|
- emptyTip: this.lp.inputYourPassword,
|
|
|
+ emptyTip: this.lp.inputYourOldPassword,
|
|
|
event: {
|
|
|
focus: function (it) {
|
|
|
if ("password" === it.getValue()) it.setValue("");
|
|
|
@@ -2175,22 +2122,21 @@ MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
it.getElements()[0].setStyles(this.css.inputPassword);
|
|
|
}.bind(this)
|
|
|
},
|
|
|
- captchaAnswer: {
|
|
|
- tType: "number",
|
|
|
- text: this.lp.verificationCode,
|
|
|
- defaultValue: this.lp.verificationCode,
|
|
|
- className: "inputVerificationCode",
|
|
|
+ newPassword: {
|
|
|
+ text: this.lp.newPassword,
|
|
|
+ type: "password",
|
|
|
+ defaultValue: "password",
|
|
|
+ className: "inputPassword",
|
|
|
notEmpty: true,
|
|
|
defaultValueAsEmpty: true,
|
|
|
- emptyTip: this.lp.inputPicVerificationCode,
|
|
|
+ emptyTip: this.lp.inputYourNewPassword,
|
|
|
event: {
|
|
|
focus: function (it) {
|
|
|
- if (this.lp.verificationCode === it.getValue()) it.setValue("");
|
|
|
+ if ("password" === it.getValue()) it.setValue("");
|
|
|
if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputActive);
|
|
|
}.bind(this),
|
|
|
blur: function (it) {
|
|
|
- if ("" === it.getValue()) it.setValue(this.lp.verificationCode);
|
|
|
- if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputVerificationCode);
|
|
|
+ if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputPassword);
|
|
|
}.bind(this),
|
|
|
keyup: function (it, ev) {
|
|
|
if (ev.event.keyCode === 13) this.ok();
|
|
|
@@ -2200,34 +2146,24 @@ MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
it.getElements()[0].setStyles(this.css.inputEmpty);
|
|
|
}.bind(this),
|
|
|
onUnempty: function (it) {
|
|
|
- it.getElements()[0].setStyles(this.css.inputVerificationCode);
|
|
|
+ it.getElements()[0].setStyles(this.css.inputPassword);
|
|
|
}.bind(this)
|
|
|
},
|
|
|
- changeCaptchaAction: {
|
|
|
- value: this.lp.changeVerification,
|
|
|
- type: "innerText",
|
|
|
- className: "verificationChange",
|
|
|
- event: {
|
|
|
- click: function () {
|
|
|
- this.setCaptchaPic();
|
|
|
- }.bind(this)
|
|
|
- }
|
|
|
- },
|
|
|
- codeAnswer: {
|
|
|
- text: this.lp.verificationCode,
|
|
|
- defaultValue: this.lp.inputVerificationCode,
|
|
|
- className: "inputVerificationCode2",
|
|
|
+ confirmPassword: {
|
|
|
+ text: this.lp.confirmPassword,
|
|
|
+ type: "password",
|
|
|
+ defaultValue: "password",
|
|
|
+ className: "inputPassword",
|
|
|
notEmpty: true,
|
|
|
defaultValueAsEmpty: true,
|
|
|
- emptyTip: this.lp.inputVerificationCode,
|
|
|
+ emptyTip: this.lp.inputYourNewPassword,
|
|
|
event: {
|
|
|
focus: function (it) {
|
|
|
- if (this.lp.inputVerificationCode === it.getValue()) it.setValue("");
|
|
|
+ if ("password" === it.getValue()) it.setValue("");
|
|
|
if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputActive);
|
|
|
}.bind(this),
|
|
|
blur: function (it) {
|
|
|
- if ("" === it.getValue()) it.setValue(this.lp.inputVerificationCode);
|
|
|
- if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputVerificationCode2);
|
|
|
+ if (!it.warningStatus) it.getElements()[0].setStyles(this.css.inputPassword);
|
|
|
}.bind(this),
|
|
|
keyup: function (it, ev) {
|
|
|
if (ev.event.keyCode === 13) this.ok();
|
|
|
@@ -2237,26 +2173,11 @@ MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
it.getElements()[0].setStyles(this.css.inputEmpty);
|
|
|
}.bind(this),
|
|
|
onUnempty: function (it) {
|
|
|
- it.getElements()[0].setStyles(this.css.inputVerificationCode2);
|
|
|
+ it.getElements()[0].setStyles(this.css.inputPassword);
|
|
|
}.bind(this)
|
|
|
},
|
|
|
- verificationAction: {
|
|
|
- value: this.lp.sendVerification,
|
|
|
- type: "button",
|
|
|
- className: "inputSendVerification",
|
|
|
- event: {
|
|
|
- click: function () {
|
|
|
- this.sendVerificationAction();
|
|
|
- }.bind(this)
|
|
|
- }
|
|
|
- },
|
|
|
- resendVerificationAction: {
|
|
|
- value: this.lp.resendVerification,
|
|
|
- type: "button",
|
|
|
- className: "inputResendVerification"
|
|
|
- },
|
|
|
- loginAction: {
|
|
|
- value: this.lp.loginAction,
|
|
|
+ submitAction: {
|
|
|
+ value: this.lp.submitAction,
|
|
|
type: "button",
|
|
|
className: "inputLogin",
|
|
|
event: {
|
|
|
@@ -2265,36 +2186,6 @@ MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
}.bind(this)
|
|
|
}
|
|
|
},
|
|
|
- passwordAction: {
|
|
|
- value: this.lp.passwordLogin,
|
|
|
- type: "innerText",
|
|
|
- className: "titleNode_active",
|
|
|
- event: {
|
|
|
- click: function () {
|
|
|
- if (this.codeLogin) this.showPasswordLogin();
|
|
|
- }.bind(this)
|
|
|
- }
|
|
|
- },
|
|
|
- codeAction: {
|
|
|
- value: this.lp.codeLogin,
|
|
|
- type: "innerText",
|
|
|
- className: "titleNode_normal",
|
|
|
- event: {
|
|
|
- click: function () {
|
|
|
- this.showCodeLogin();
|
|
|
- }.bind(this)
|
|
|
- }
|
|
|
- },
|
|
|
- signUpAction: {
|
|
|
- value: this.lp.signUp,
|
|
|
- type: "innerText",
|
|
|
- className: "signUpAction",
|
|
|
- event: {
|
|
|
- click: function () {
|
|
|
- this.gotoSignup();
|
|
|
- }.bind(this)
|
|
|
- }
|
|
|
- },
|
|
|
forgetPassword: {
|
|
|
value: this.lp.forgetPassword,
|
|
|
type: "innerText",
|
|
|
@@ -2310,317 +2201,11 @@ MWF.xDesktop.Authentication.ChangePasswordForm = new Class({
|
|
|
this.form.load();
|
|
|
}.bind(this), true);
|
|
|
|
|
|
- if (this.bindLogin) {
|
|
|
- this.bindLoginContainer = new Element("div", {
|
|
|
- styles: this.css.bindLoginContainer
|
|
|
- }).inject(this.formContentNode);
|
|
|
-
|
|
|
- var html2 = "<div item='bindLoginTitle' styles='bindTitleNode'></div>" +
|
|
|
- "<div styles='bindBodyArea'>" +
|
|
|
- "<div item='bindPicArea' styles='bindPicArea'></div>" +
|
|
|
- "<div styles='bindSepArea'></div>" +
|
|
|
- "<div styles='bindExampleArea'></div>" +
|
|
|
- "</div>" +
|
|
|
- "<div styles='bindTipArea'>" +
|
|
|
- " <div styles='bindTipIconArea'></div>" +
|
|
|
- " <div styles='bindTipTextArea'>" +
|
|
|
- " <div>打开<div styles='bindTipLinkArea'>APP</div>扫一扫</div>" +
|
|
|
- " <div>登录网页版</div>" +
|
|
|
- "</div>";
|
|
|
-
|
|
|
- this.bindLoginContainer.set("html", html2);
|
|
|
-
|
|
|
- this.isShowEnable = true;
|
|
|
- this.bindBodyArea = this.bindLoginContainer.getElement("[styles='bindBodyArea']");
|
|
|
- this.bindLoginContainer.addEvent("mousemove", function (ev) {
|
|
|
- if (this.bindBodyArea.isOutside(ev)) {
|
|
|
- this.hideExampleArea(ev);
|
|
|
- } else {
|
|
|
- this.showExampleArea(ev);
|
|
|
- }
|
|
|
- }.bind(this));
|
|
|
-
|
|
|
- this.bindPicArea = this.bindLoginContainer.getElement("[item='bindPicArea']");
|
|
|
- this.setBindPic();
|
|
|
- this.bindExampleArea = this.bindLoginContainer.getElement("[styles='bindExampleArea']");
|
|
|
- this.bindSepArea = this.bindLoginContainer.getElement("[styles='bindSepArea']");
|
|
|
- var link = this.bindLoginContainer.getElement("[styles='bindTipLinkArea']");
|
|
|
- link.addEvent("click", function () {
|
|
|
- if( layout.config.appUrl ){
|
|
|
- window.open(layout.config.appUrl, "_blank");
|
|
|
- }else{
|
|
|
- window.open(this.lp.o2downloadLink, "_blank");
|
|
|
- }
|
|
|
- }.bind(this));
|
|
|
-
|
|
|
- MWF.xDesktop.requireApp("Template", "MForm", function () {
|
|
|
- this.bindform = new MForm(this.bindLoginContainer, {}, {
|
|
|
- style: "o2platform",
|
|
|
- verifyType: "single", //batch一起校验,或alert弹出
|
|
|
- isEdited: this.isEdited || this.isNew,
|
|
|
- itemTemplate: {
|
|
|
- bindLoginTitle: { value: this.lp.bingLoginTitle, type: "innerText" }
|
|
|
- }
|
|
|
- }, this.app, this.css);
|
|
|
- this.bindform.load();
|
|
|
- }.bind(this), true);
|
|
|
- }
|
|
|
-
|
|
|
- this.loadOauthContent()
|
|
|
-
|
|
|
- },
|
|
|
- _beforeFormNodeSize: function () {
|
|
|
- if (!this.isPlusOauthSize && this.oauthListNode) {
|
|
|
- this.options.height = parseInt(this.options.height) + this.oauthArea.getSize().y;
|
|
|
- this.isPlusOauthSize = true;
|
|
|
- }
|
|
|
- if (this.oauthListNode || (!this.captchaLogin && !this.bindLogin)) { //留高度给二维码
|
|
|
- this.options.height = this.options.height - 60;
|
|
|
- }
|
|
|
- if (this.oauthListNode && this.captchaLogin) {
|
|
|
- this.options.height = this.options.height + 60;
|
|
|
- }
|
|
|
- },
|
|
|
- loadOauthContent: function () {
|
|
|
- this.actions.listOauthServer(function (json) {
|
|
|
- this.oauthList = json.data || [];
|
|
|
- if (this.oauthList.length > 0) {
|
|
|
- if (!this.oauthArea.getChildren().length) {
|
|
|
- this.oauthListNode = new Element("div", { styles: this.css.oauthListNode }).inject(this.oauthArea);
|
|
|
- }
|
|
|
- this.oauthList.each(function (d) {
|
|
|
- if (d.displayName === "@O2企业微信") {
|
|
|
- d.qywx = true;
|
|
|
- } else if (d.displayName === "@O2钉钉") {
|
|
|
- d.dingding = true;
|
|
|
- }
|
|
|
- this.loadOauthItem(d);
|
|
|
- }.bind(this));
|
|
|
- }
|
|
|
- }.bind(this), null, false);
|
|
|
-
|
|
|
- },
|
|
|
- loadOauthItem: function (data) {
|
|
|
- var url = data.icon.indexOf("http") == 0 ? data.icon : ("data:image/png;base64," + data.icon);
|
|
|
-
|
|
|
- var itemNode = new Element("div", {
|
|
|
- styles: this.css.oauthItemNode,
|
|
|
- events: {
|
|
|
- click: function () {
|
|
|
- var url = "../x_desktop/oauth.html?oauth=" + encodeURIComponent(this.name);
|
|
|
- if (this.qywx) {
|
|
|
- url += "&qywx=" + this.qywx;
|
|
|
- }
|
|
|
- if (this.dingding) {
|
|
|
- url += "&dingding=" + this.dingding;
|
|
|
- }
|
|
|
- window.location = url;
|
|
|
- }.bind(data)
|
|
|
- }
|
|
|
- }).inject(this.oauthListNode);
|
|
|
- var iconNode = new Element("img", {
|
|
|
- styles: this.css.oauthItemIconNode,
|
|
|
- src: url
|
|
|
- }).inject(itemNode);
|
|
|
- var textNode = new Element("div", {
|
|
|
- styles: this.css.oauthItemTextNode,
|
|
|
- text: data.name
|
|
|
- }).inject(itemNode);
|
|
|
- },
|
|
|
- showExampleArea: function () {
|
|
|
- if (this.isHiddingExample || this.isShowingExample) return;
|
|
|
- if (!this.isShowEnable) return;
|
|
|
- this.isShowingExample = true;
|
|
|
- var left = this.bindBodyArea.getPosition(this.bindBodyArea.getParent()).x;
|
|
|
- var hideLeft = ((this.bindBodyArea.getParent().getSize().x) - 400) / 2;
|
|
|
- debugger;
|
|
|
- this.intervalId = setInterval(function () {
|
|
|
- if (left > hideLeft) {
|
|
|
- this.bindBodyArea.setStyle("margin-left", (left - 5) + "px");
|
|
|
- left = left - 5;
|
|
|
- } else {
|
|
|
- clearInterval(this.intervalId);
|
|
|
- this.bindBodyArea.setStyle("width", "400px");
|
|
|
- this.bindSepArea.setStyle("display", "");
|
|
|
- this.bindExampleArea.setStyle("display", "");
|
|
|
- this.isHidEnable = true;
|
|
|
- this.isShowEnable = false;
|
|
|
- this.isShowingExample = false;
|
|
|
- }
|
|
|
- }.bind(this), 10)
|
|
|
- },
|
|
|
- hideExampleArea: function () {
|
|
|
- if (this.isShowingExample || this.isHiddingExample) return;
|
|
|
- if (!this.isHidEnable) return;
|
|
|
- this.isHiddingExample = true;
|
|
|
- var left = this.bindBodyArea.getPosition(this.bindBodyArea.getParent()).x;
|
|
|
- this.bindSepArea.setStyle("display", "none");
|
|
|
- this.bindExampleArea.setStyle("display", "none");
|
|
|
- var hideLeft = ((this.bindBodyArea.getParent().getSize().x) - 200) / 2;
|
|
|
- this.intervalId2 = setInterval(function () {
|
|
|
- if (left < hideLeft) {
|
|
|
- this.bindBodyArea.setStyle("margin-left", (left + 5) + "px");
|
|
|
- left = left + 5;
|
|
|
- } else {
|
|
|
- clearInterval(this.intervalId2);
|
|
|
- this.bindBodyArea.setStyle("width", "204px");
|
|
|
- this.isHidEnable = false;
|
|
|
- this.isShowEnable = true;
|
|
|
- this.isHiddingExample = false;
|
|
|
- }
|
|
|
- }.bind(this), 10)
|
|
|
- },
|
|
|
- showPasswordLogin: function () {
|
|
|
- this.errorArea.empty();
|
|
|
- this.loginType = "captcha";
|
|
|
- this.form.getItem("passwordAction").setStyles(this.css.titleNode_active);
|
|
|
- this.form.getItem("codeAction").setStyles(this.css.titleNode_normal);
|
|
|
- this.formTableArea.getElement("[item='passwordTr']").setStyle("display", "");
|
|
|
- var captchaTr = this.formTableArea.getElement("[item='captchaTr']");
|
|
|
- if (captchaTr) captchaTr.setStyle("display", "");
|
|
|
- this.formTableArea.getElement("[item='codeTr']").setStyle("display", "none");
|
|
|
- },
|
|
|
- showCodeLogin: function () {
|
|
|
- this.errorArea.empty();
|
|
|
- this.loginType = "code";
|
|
|
- this.form.getItem("passwordAction").setStyles(this.css.titleNode_normal);
|
|
|
- this.form.getItem("codeAction").setStyles(this.css.titleNode_active);
|
|
|
- this.formTableArea.getElement("[item='passwordTr']").setStyle("display", "none");
|
|
|
- var captchaTr = this.formTableArea.getElement("[item='captchaTr']");
|
|
|
- if (captchaTr) captchaTr.setStyle("display", "none");
|
|
|
- this.formTableArea.getElement("[item='codeTr']").setStyle("display", "");
|
|
|
-
|
|
|
- },
|
|
|
- showBindCodeLogin: function () {
|
|
|
- this.errorArea.empty();
|
|
|
- this.formTableContainer.setStyle("display", "none");
|
|
|
- this.bindLoginContainer.setStyle("display", "");
|
|
|
- this.bindLoginTipPic.setStyle("display", "none");
|
|
|
- this.bindLoginAction.setStyle("display", "none");
|
|
|
- this.backtoPasswordLoginTipPic.setStyle("display", "");
|
|
|
- this.backtoPasswordLoginAction.setStyle("display", "");
|
|
|
- this.checkBindStatus();
|
|
|
- },
|
|
|
- backtoPasswordLogin: function () {
|
|
|
- this.errorArea.empty();
|
|
|
- if (this.bindStatusInterval) clearInterval(this.bindStatusInterval);
|
|
|
- this.formTableContainer.setStyle("display", "");
|
|
|
- this.bindLoginContainer.setStyle("display", "none");
|
|
|
- this.bindLoginTipPic.setStyle("display", "");
|
|
|
- this.bindLoginAction.setStyle("display", "");
|
|
|
- this.backtoPasswordLoginTipPic.setStyle("display", "none");
|
|
|
- this.backtoPasswordLoginAction.setStyle("display", "none");
|
|
|
- },
|
|
|
- setBindPic: function () {
|
|
|
- this.bindPicArea.empty();
|
|
|
- this.actions.getLoginBind(function (json) {
|
|
|
- this.bindMeta = json.data.meta;
|
|
|
- new Element("img", {
|
|
|
- src: "data:image/png;base64," + json.data.image
|
|
|
- }).inject(this.bindPicArea);
|
|
|
- }.bind(this))
|
|
|
- },
|
|
|
- setCaptchaPic: function () {
|
|
|
- if (!this.captchaLogin) return;
|
|
|
- var captchaPic = this.formTableArea.getElement("[item='captchaPic']");
|
|
|
- captchaPic.empty();
|
|
|
- this.actions.getLoginCaptcha(120, 50, function (json) {
|
|
|
- this.captcha = json.data.id;
|
|
|
- new Element("img", {
|
|
|
- src: "data:image/png;base64," + json.data.image,
|
|
|
- styles: this.css.verificationImage
|
|
|
- }).inject(captchaPic);
|
|
|
- }.bind(this))
|
|
|
- },
|
|
|
- sendVerificationAction: function () {
|
|
|
- var flag = true;
|
|
|
- var credentialItem = this.form.getItem("credential");
|
|
|
- var credential = credentialItem.getValue();
|
|
|
- if (!credential || credential.trim() === "") {
|
|
|
- credentialItem.setWarning(this.lp.inputYourUserName, "empty");
|
|
|
- return;
|
|
|
- } else {
|
|
|
- this.actions.checkCredential(credential, function (json) {
|
|
|
- if (!json.data.value) {
|
|
|
- flag = false;
|
|
|
- credentialItem.setWarning(this.lp.userNotExist, "invalid");
|
|
|
- }
|
|
|
- }.bind(this), function (errorObj) {
|
|
|
- flag = false;
|
|
|
- var error = JSON.parse(errorObj.responseText);
|
|
|
- credentialItem.setWarning(error.message, "invalid");
|
|
|
- }.bind(this), false)
|
|
|
- }
|
|
|
- if (!flag) {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- credentialItem.clearWarning("invalid");
|
|
|
- }
|
|
|
- this.actions.createCredentialCode(credential, function (json) {
|
|
|
- }, function (errorObj) {
|
|
|
- var error = JSON.parse(errorObj.responseText);
|
|
|
- this.setWarning(error.message);
|
|
|
- flag = false
|
|
|
- }.bind(this));
|
|
|
- if (!flag) {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- this.errorArea.empty();
|
|
|
- }
|
|
|
- this.form.getItem("verificationAction").container.setStyle("display", "none");
|
|
|
- this.setResendVerification();
|
|
|
- },
|
|
|
- setResendVerification: function () {
|
|
|
- var resendItem = this.form.getItem("resendVerificationAction");
|
|
|
- resendItem.container.setStyle("display", "");
|
|
|
- this.resendElement = resendItem.getElements()[0];
|
|
|
- this.resendElement.set("text", this.lp.resendVerification + "(60)");
|
|
|
-
|
|
|
- var i = 60;
|
|
|
- this.timer = setInterval(function () {
|
|
|
- if (i > 0) {
|
|
|
- this.resendElement.set("text", this.lp.resendVerification + "(" + --i + ")")
|
|
|
- } else {
|
|
|
- this.form.getItem("verificationAction").container.setStyle("display", "");
|
|
|
- resendItem.container.setStyle("display", "none");
|
|
|
- clearInterval(this.timer)
|
|
|
- }
|
|
|
- }.bind(this), 1000)
|
|
|
- },
|
|
|
- gotoSignup: function () {
|
|
|
- this.explorer.openSignUpForm();
|
|
|
- //this.explorer.openResetPasswordForm();
|
|
|
- this.close();
|
|
|
},
|
|
|
gotoResetPassword: function () {
|
|
|
this.explorer.openResetPasswordForm();
|
|
|
this.close();
|
|
|
},
|
|
|
- checkBindStatus: function () {
|
|
|
- this.bindStatusInterval = setInterval(function () {
|
|
|
- this.actions.checkBindStatus(this.bindMeta, function (json) {
|
|
|
- if (json.data) {
|
|
|
- if (json.data.name && json.data.name !== "anonymous") {
|
|
|
- this.fireEvent("queryOk");
|
|
|
- this._close();
|
|
|
- if (this.formMaskNode) this.formMaskNode.destroy();
|
|
|
- this.formAreaNode.destroy();
|
|
|
- if (this.explorer && this.explorer.view) this.explorer.view.reload();
|
|
|
- if (this.app) this.app.notice(this.lp.loginSuccess, "success");
|
|
|
- this.fireEvent("postOk", json);
|
|
|
- }
|
|
|
- }
|
|
|
- }.bind(this), function (errorObj) {
|
|
|
- //var error = JSON.parse( errorObj.responseText );
|
|
|
- //this.setWarning( error.message );
|
|
|
- }.bind(this))
|
|
|
- }.bind(this), 3000);
|
|
|
-
|
|
|
- },
|
|
|
- _close: function () {
|
|
|
- if (this.bindStatusInterval) clearInterval(this.bindStatusInterval);
|
|
|
- if (this.timer) clearInterval(this.timer);
|
|
|
- },
|
|
|
ok: function () {
|
|
|
this.fireEvent("queryOk");
|
|
|
this.errorArea.empty();
|