-
Notifications
You must be signed in to change notification settings - Fork 0
/
_boc_createElement.js
153 lines (144 loc) · 3.08 KB
/
_boc_createElement.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/**
* \u521b\u5efa\u5b89\u5168\u63a7\u4ef6\u811a\u672c
*/
var rs = "";
function CreateControl(DivID, Form, ObjectID, mode, language) {
var d = document.getElementById(DivID);
var obj = document.createElement('object');
d.appendChild(obj);
obj.width = 162;
obj.height = 20;
obj.classid="clsid:E61E8363-041F-455c-8AD0-8A61F1D8E540";
obj.id=ObjectID;
var version = getVersion(obj);
passInit(obj, mode, language, version);
var rc = null;
if (version >= 66816) { //66560 1.4.0.0 //66306 1.3.0.2 //66305 1.3.0.1 //65539 1.3.0
getRS();
if (rs != "") {
obj.RandomKey_S = rs;
rc = obj.RandomKey_C;
}
}
return rc;
}
/**
* \u53d6\u63a7\u4ef6\u7248\u672c\u53f7
*/
function getVersion(obj) {
try {
var version = obj.Version;
try {
if (version == undefined)
return 0;
} catch(ve) {//IE5.0
return 0;
}
return version;
}
catch(e) {
return 0;
}
}
/**
* \u53d6rs
*/
function getRS() {
if (rs == "") {
url = "refreshrs.do";
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
if(xmlhttp) {
xmlhttp.open("POST", url, false);
xmlhttp.send();
rs = xmlhttp.responseText;
if (rs == null) {
alert("Control rs error.");
rs = "";
}
else {
rs = rs.replace(/[ \t\r\n]/g, "");
if (rs.length != 24) {
alert("Control rs error:" + rs.length);
rs = "";
}
}
}
}
}
/**
* \u53d6\u63a7\u4ef6\u7248\u72b6\u6001
*/
function getState(obj) {
try {
var state = obj.State;
try {
if (state == undefined)
return 0;
} catch(ve) {//IE5.0
return 0;
}
return state;
}
catch(e) {
return 0;
}
}
/**
* \u63a7\u4ef6\u68c0\u6d4b
*/
function passControlCheck(obj, mode, language) {
try {
var version = getVersion(obj);
passInit(obj, mode, language, version);
if (version < 65539) {//66560 1.4.0.0 //66306 1.3.0.2 //66305 1.3.0.1 //65539 1.3.0
alert(SAFECONTROL_VERSION);
return false;
}
}
catch(e) {
alert(SAFECONTROL_INSTALL);
return false;
}
return true;
}
/**
* \u8bbe\u7f6e\u63a7\u4ef6
*/
function passInit(obj, mode, language, version) {
obj.SetLanguage(language);
//\u53e3\u4ee4
if (mode == 0) {
obj.PasswordIntensityMinLength = 1;
obj.MaxLength = 20;
obj.OutputValueType = 2;
obj.PasswordIntensityRegularExpression = "^[!-~]*$";
}
//\u65b0\u53e3\u4ee4
else if (mode == 1) {
obj.PasswordIntensityMinLength = 8;
obj.MaxLength = 20;
obj.OutputValueType = 2;
obj.PasswordIntensityRegularExpression = "(^[!-~]*[A-Za-z]+[!-~]*[0-9]+[!-~]*$)|(^[!-~]*[0-9]+[!-~]*[A-Za-z]+[!-~]*$)";
}
//\u52a8\u6001\u53e3\u4ee4
else if (mode == 2) {
obj.PasswordIntensityMinLength = 6;
obj.MaxLength = 6;
obj.OutputValueType = 1;
obj.PasswordIntensityRegularExpression = "^[0-9]{6}$";
}
//\u7535\u8bdd\u94f6\u884c\u5bc6\u7801
else if (mode == 3) {
obj.PasswordIntensityMinLength = 6;
obj.MaxLength = 6;
obj.OutputValueType = 1;
obj.PasswordIntensityRegularExpression = "^[0-9]{6}$";
}
//\u624b\u673a\u94f6\u884c\u5bc6\u7801
else if (mode == 4) {
obj.PasswordIntensityMinLength = 8;
obj.MaxLength = 20;
obj.OutputValueType = 1;
obj.PasswordIntensityRegularExpression = "^[!-~]*$";
}
}