jQuery(document).ready(function() {
	$("#resetPasswordForm").validate({
		submitHandler : function(form) {
			$(form).ajaxSubmit({
				success : function(e) {
					if (e && e.success == true) {
						$("#grid-table").trigger("reloadGrid"); // 重新载入
						sxUtil.msgbox.success('操作成功！');
						sxUtil.dialog.close($(form).data('index'));
					} else {
						sxUtil.msgbox.error(e, '修改失败');
					}
				}
			});
		},
		rules : {
			'password' : {
				required : true,
				checkPassword : true
			}
		},
		messages : {
			'password' : {
				required : "密码不能为空"
			}
		}
	});

	$.validator.addMethod("checkPassword", function(value, element, params) {
		var checkPassword = /^[0-9A-Za-z]{5,32}$/;
		return this.optional(element) || (checkPassword.test(value));
	}, "密码必须是5~32位数字和字母的组合");
});