2020-07-22 22:19:39 +08:00
|
|
|
Tea.context(function () {
|
2020-12-24 17:15:53 +08:00
|
|
|
this.username = ""
|
|
|
|
|
this.password = ""
|
|
|
|
|
this.passwordMd5 = ""
|
|
|
|
|
this.encodedFrom = window.encodeURIComponent(this.from)
|
2020-07-22 22:19:39 +08:00
|
|
|
|
2020-12-24 17:15:53 +08:00
|
|
|
this.showOTP = false
|
|
|
|
|
|
|
|
|
|
this.isSubmitting = false
|
2020-07-22 22:19:39 +08:00
|
|
|
|
|
|
|
|
this.$delay(function () {
|
2020-12-24 17:15:53 +08:00
|
|
|
this.$find("form input[name='username']").focus()
|
|
|
|
|
this.changePassword()
|
2020-07-22 22:19:39 +08:00
|
|
|
});
|
|
|
|
|
|
2020-12-24 17:15:53 +08:00
|
|
|
this.changeUsername = function () {
|
|
|
|
|
this.$post("/checkOTP")
|
|
|
|
|
.params({
|
|
|
|
|
username: this.username
|
|
|
|
|
})
|
|
|
|
|
.success(function (resp) {
|
|
|
|
|
this.showOTP = resp.data.requireOTP
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 22:19:39 +08:00
|
|
|
this.changePassword = function () {
|
|
|
|
|
this.passwordMd5 = md5(this.password.trim());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 更多选项
|
|
|
|
|
this.moreOptionsVisible = false;
|
|
|
|
|
this.showMoreOptions = function () {
|
|
|
|
|
this.moreOptionsVisible = !this.moreOptionsVisible;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.submitBefore = function () {
|
|
|
|
|
this.isSubmitting = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.submitDone = function () {
|
|
|
|
|
this.isSubmitting = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.submitSuccess = function () {
|
|
|
|
|
if (this.from.length == 0) {
|
|
|
|
|
window.location = "/dashboard";
|
|
|
|
|
} else {
|
|
|
|
|
window.location = this.from;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|