You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
59 lines
1.9 KiB
var EditPasswordDialog = function (parent) {
|
|
this.Parent = parent;
|
|
this.User = {};
|
|
|
|
this.Setup = function () {
|
|
$("#edit-password-sure-btn").on("click", this.OnSureButtonClick.bind(this));
|
|
$("#edit-password-cancel-btn").on("click", this.HideDialog.bind(this));
|
|
$("#edit-password-close").on("click", this.HideDialog.bind(this));
|
|
};
|
|
|
|
this.Show = function (data) {
|
|
this.User = data;
|
|
console.log(this.User)
|
|
$('#edit-password-dialog').show();
|
|
};
|
|
|
|
this.OnSureButtonClick = function () {
|
|
this.validation();
|
|
};
|
|
|
|
this.validation = function () {
|
|
if ($("#password").textbox('getValue').trim() === '' || $("#password").textbox('getValue').trim === null) {
|
|
alert('请输入新密码');
|
|
return
|
|
} else if ($("#confirm-password").textbox('getValue').trim() === '' || $("#confirm-password").textbox('getValue').trim === null) {
|
|
alert('请输入确认密码');
|
|
return
|
|
} else if ($("#password").textbox('getValue') !== $("#confirm-password").textbox('getValue')) {
|
|
alert('两次输入的密码不一致');
|
|
return;
|
|
} else {
|
|
this.EditUser();
|
|
this.HideDialog();
|
|
}
|
|
};
|
|
|
|
this.HideDialog = function () {
|
|
$('#edit-password-dialog').hide();
|
|
$('#password').textbox('setValue', '');
|
|
$('#confirm-password').textbox('setValue', '');
|
|
};
|
|
|
|
this.EditUser = function () {
|
|
console.log(this.User.Id);
|
|
console.log($('#password').textbox('getValue'))
|
|
$.ajax({
|
|
type: "POST",
|
|
dataType: 'text',
|
|
url: '/UserManagement/UpdatePassword',
|
|
data: {
|
|
id: this.User.Id,
|
|
newPassword: $('#password').textbox('getValue'),
|
|
},
|
|
success: function (result) {
|
|
console.log(result)
|
|
}.bind(this)
|
|
});
|
|
};
|
|
};
|