author | Dan |
Sun, 07 Oct 2007 21:28:36 -0400 | |
changeset 179 | 36b287f1d85c |
parent 176 | 1bc7e849a264 |
child 182 | c69730750be3 |
permissions | -rw-r--r-- |
1 | 1 |
// Some additional DHTML functions |
2 |
||
3 |
function fetch_offset(obj) { |
|
4 |
var left_offset = obj.offsetLeft; |
|
5 |
var top_offset = obj.offsetTop; |
|
6 |
while ((obj = obj.offsetParent) != null) { |
|
7 |
left_offset += obj.offsetLeft; |
|
8 |
top_offset += obj.offsetTop; |
|
9 |
} |
|
10 |
return { 'left' : left_offset, 'top' : top_offset }; |
|
11 |
} |
|
12 |
||
13 |
function fetch_dimensions(o) { |
|
14 |
var w = o.offsetWidth; |
|
15 |
var h = o.offsetHeight; |
|
16 |
return { 'w' : w, 'h' : h }; |
|
17 |
} |
|
18 |
||
19 |
function findParentForm(o) |
|
20 |
{ |
|
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
21 |
if ( o.tagName == 'FORM' ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
22 |
return o; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
23 |
while(true) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
24 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
25 |
o = o.parentNode; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
26 |
if ( !o ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
27 |
return false; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
28 |
if ( o.tagName == 'FORM' ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
29 |
return o; |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
30 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
31 |
return false; |
1 | 32 |
} |
33 |
||
34 |
function ajaxReverseDNS(o, text) |
|
35 |
{ |
|
36 |
if(text) var ipaddr = text; |
|
37 |
else var ipaddr = o.innerHTML; |
|
38 |
rDnsObj = o; |
|
39 |
rDnsBannerObj = bannerOn('Retrieving reverse DNS info...'); |
|
40 |
ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function() { |
|
41 |
if(ajax.readyState == 4) |
|
42 |
{ |
|
43 |
off = fetch_offset(rDnsObj); |
|
44 |
dim = fetch_dimensions(rDnsObj); |
|
45 |
right = off['left'] + dim['w']; |
|
46 |
top = off['top'] + dim['h']; |
|
47 |
var thediv = document.createElement('div'); |
|
48 |
thediv.className = 'info-box'; |
|
49 |
thediv.style.margin = '0'; |
|
50 |
thediv.style.position = 'absolute'; |
|
51 |
thediv.style.top = top + 'px'; |
|
52 |
thediv.style.display = 'none'; |
|
53 |
thediv.style.zIndex = getHighestZ() + 2; |
|
54 |
thediv.id = 'mdgDynamic_rDnsInfoDiv_'+Math.floor(Math.random() * 1000000); |
|
55 |
thediv.innerHTML = '<b>Reverse DNS:</b><br />'+ajax.responseText+' <a href="#" onclick="elem = document.getElementById(\''+thediv.id+'\'); elem.innerHTML = \'\'; elem.style.display = \'none\';return false;">Close</a>'; |
|
56 |
var body = document.getElementsByTagName('body'); |
|
57 |
body = body[0]; |
|
58 |
bannerOff(rDnsBannerObj); |
|
59 |
body.appendChild(thediv); |
|
60 |
thediv.style.display = 'block'; |
|
61 |
left = fetch_dimensions(thediv); |
|
62 |
thediv.style.display = 'none'; |
|
63 |
left = right - left['w']; |
|
64 |
thediv.style.left = left + 'px'; |
|
65 |
thediv.style.display = 'block'; |
|
66 |
fadeInfoBoxes(); |
|
67 |
} |
|
68 |
}); |
|
69 |
} |
|
70 |
||
71 |
function bannerOn(text) |
|
72 |
{ |
|
73 |
darken(true); |
|
74 |
var thediv = document.createElement('div'); |
|
75 |
thediv.className = 'mdg-comment'; |
|
76 |
thediv.style.padding = '0'; |
|
77 |
thediv.style.marginLeft = '0'; |
|
78 |
thediv.style.position = 'absolute'; |
|
79 |
thediv.style.display = 'none'; |
|
80 |
thediv.style.padding = '4px'; |
|
81 |
thediv.style.fontSize = '14pt'; |
|
82 |
thediv.id = 'mdgDynamic_bannerDiv_'+Math.floor(Math.random() * 1000000); |
|
83 |
thediv.innerHTML = text; |
|
84 |
||
85 |
var body = document.getElementsByTagName('body'); |
|
86 |
body = body[0]; |
|
87 |
body.appendChild(thediv); |
|
88 |
body.style.cursor = 'wait'; |
|
89 |
||
90 |
thediv.style.display = 'block'; |
|
91 |
dim = fetch_dimensions(thediv); |
|
92 |
thediv.style.display = 'none'; |
|
93 |
bdim = { 'w' : getWidth(), 'h' : getHeight() }; |
|
94 |
so = getScrollOffset(); |
|
95 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
96 |
var left = (bdim['w'] / 2) - ( dim['w'] / 2 ); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
97 |
|
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
98 |
var top = (bdim['h'] / 2); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
99 |
top = top - ( dim['h'] / 2 ); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
100 |
|
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
101 |
top = top + so; |
1 | 102 |
|
103 |
thediv.style.top = top + 'px'; |
|
104 |
thediv.style.left = left + 'px'; |
|
105 |
||
106 |
thediv.style.display = 'block'; |
|
107 |
||
108 |
return thediv.id; |
|
109 |
} |
|
110 |
||
111 |
function bannerOff(id) |
|
112 |
{ |
|
113 |
e = document.getElementById(id); |
|
114 |
if(!e) return; |
|
115 |
e.innerHTML = ''; |
|
116 |
e.style.display = 'none'; |
|
117 |
var body = document.getElementsByTagName('body'); |
|
118 |
body = body[0]; |
|
119 |
body.style.cursor = 'default'; |
|
120 |
enlighten(true); |
|
121 |
} |
|
122 |
||
123 |
function disableUnload(message) |
|
124 |
{ |
|
125 |
if(typeof message != 'string') message = 'You may want to save your changes first.'; |
|
126 |
var body = document.getElementsByTagName('body'); |
|
127 |
body = body[0]; |
|
128 |
body.onbeforeunload='return unescape(\''+escape(message)+'\')'; |
|
129 |
} |
|
130 |
||
131 |
function enableUnload() |
|
132 |
{ |
|
133 |
var body = document.getElementsByTagName('body'); |
|
134 |
body = body[0]; |
|
135 |
body.onbeforeunload = null; |
|
136 |
} |
|
137 |
||
138 |
/** |
|
139 |
* Gets the highest z-index of all divs in the document |
|
140 |
* @return integer |
|
141 |
*/ |
|
142 |
function getHighestZ() |
|
143 |
{ |
|
144 |
z = 0; |
|
145 |
var divs = document.getElementsByTagName('div'); |
|
146 |
for(var i = 0; i < divs.length; i++) |
|
147 |
{ |
|
148 |
if(divs[i].style.zIndex > z) z = divs[i].style.zIndex; |
|
149 |
} |
|
150 |
return z; |
|
151 |
} |
|
152 |
||
153 |
function isKeyPressed(event) |
|
154 |
{ |
|
155 |
if (event.shiftKey==1) |
|
156 |
{ |
|
157 |
shift = true; |
|
158 |
} |
|
159 |
else |
|
160 |
{ |
|
161 |
shift = false; |
|
162 |
} |
|
163 |
} |
|
164 |
||
165 |
function moveDiv(div, newparent) |
|
166 |
{ |
|
167 |
var backup = div; |
|
168 |
var oldparent = div.parentNode; |
|
169 |
oldparent.removeChild(div); |
|
170 |
newparent.appendChild(backup); |
|
171 |
} |
|
172 |
||
173 |
function readCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++){var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null;} |
|
174 |
function createCookie(name,value,days){if (days){var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";} |
|
175 |
function eraseCookie(name) {createCookie(name,"",-1);} |
|
176 |
||
177 |
var busyBannerID; |
|
178 |
function goBusy(msg) |
|
179 |
{ |
|
180 |
if(!msg) msg = 'Please wait...'; |
|
181 |
body = document.getElementsByTagName('body'); |
|
182 |
body = body[0]; |
|
183 |
body.style.cursor = 'wait'; |
|
184 |
busyBannerID = bannerOn(msg); |
|
185 |
} |
|
186 |
||
187 |
function unBusy() |
|
188 |
{ |
|
189 |
body = document.getElementsByTagName('body'); |
|
190 |
body = body[0]; |
|
191 |
body.style.cursor = 'default'; |
|
192 |
bannerOff(busyBannerID); |
|
193 |
} |
|
194 |
||
195 |
function setAjaxLoading() |
|
196 |
{ |
|
197 |
if ( document.getElementById('ajaxloadicon') ) |
|
198 |
{ |
|
199 |
document.getElementById('ajaxloadicon').src=scriptPath + '/images/loading.gif'; |
|
200 |
} |
|
201 |
} |
|
202 |
||
203 |
function unsetAjaxLoading() |
|
204 |
{ |
|
205 |
if ( document.getElementById('ajaxloadicon') ) |
|
206 |
{ |
|
207 |
document.getElementById('ajaxloadicon').src=scriptPath + '/images/spacer.gif'; |
|
208 |
} |
|
209 |
} |
|
210 |
||
211 |
/* |
|
212 |
* Search boxes |
|
213 |
*/ |
|
214 |
||
215 |
function buildSearchBoxes() |
|
216 |
{ |
|
217 |
var divs = document.getElementsByTagName('*'); |
|
218 |
var boxes = new Array(); |
|
219 |
for ( var i = 0; i < divs.length; i++ ) |
|
220 |
{ |
|
221 |
if ( divs[i].className) |
|
222 |
{ |
|
223 |
if ( divs[i].className.substr(0, 9) == 'searchbox' ) |
|
224 |
{ |
|
225 |
boxes.push(divs[i]); |
|
226 |
} |
|
227 |
} |
|
228 |
} |
|
229 |
for ( var i = 0; i < boxes.length; i++ ) |
|
230 |
{ |
|
231 |
if ( boxes[i].className.match(/^searchbox\[([0-9]+)px\]$/) ) |
|
232 |
{ |
|
233 |
var width = boxes[i].className.match(/^searchbox\[([0-9]+)px\]$/); |
|
234 |
width = parseInt(width[1]); |
|
235 |
} |
|
236 |
else |
|
237 |
{ |
|
238 |
var width = 120; |
|
239 |
} |
|
240 |
createSearchBox(boxes[i], width); |
|
241 |
} |
|
242 |
} |
|
243 |
||
244 |
function createSearchBox(parent, width) |
|
245 |
{ |
|
246 |
if ( typeof(parent) != 'object') |
|
247 |
{ |
|
248 |
alert('BUG: createSearchBox(): parent is not an object'); |
|
249 |
return false; |
|
250 |
} |
|
251 |
//parent.style.padding = '0px'; |
|
252 |
//parent.style.textAlign = 'center'; |
|
253 |
parent.style.width = width + 'px'; |
|
254 |
var submit = document.createElement('div'); |
|
255 |
submit.onclick = function() { searchFormSubmit(this); }; |
|
256 |
submit.className = 'js-search-submit'; |
|
257 |
var input = document.createElement('input'); |
|
258 |
input.className = 'js-search-box'; |
|
259 |
input.value = 'Search'; |
|
260 |
input.name = 'q'; |
|
261 |
input.style.width = ( width - 28 ) + 'px'; |
|
262 |
input.onfocus = function() { if ( this.value == 'Search' ) this.value = ''; }; |
|
263 |
input.onblur = function() { if ( this.value == '' ) this.value = 'Search'; }; |
|
264 |
parent.appendChild(input); |
|
265 |
var off = fetch_offset(input); |
|
266 |
var top = off['top'] + 'px'; |
|
267 |
var left = ( parseInt(off['left']) + ( width - 24 ) ) + 'px'; |
|
268 |
submit.style.top = top; |
|
269 |
submit.style.left = left; |
|
270 |
parent.appendChild(submit); |
|
271 |
} |
|
272 |
||
273 |
function searchFormSubmit(obj) |
|
274 |
{ |
|
275 |
var input = obj.previousSibling; |
|
276 |
if ( input.value == 'Search' || input.value == '' ) |
|
277 |
return false; |
|
278 |
var p = obj; |
|
279 |
while(true) |
|
280 |
{ |
|
281 |
p = p.parentNode; |
|
282 |
if ( !p ) |
|
283 |
break; |
|
284 |
if ( typeof(p.tagName) != 'string' ) |
|
285 |
break; |
|
286 |
else if ( p.tagName.toLowerCase() == 'form' ) |
|
287 |
{ |
|
288 |
p.submit(); |
|
289 |
} |
|
290 |
else if ( p.tagName.toLowerCase() == 'body' ) |
|
291 |
{ |
|
292 |
break; |
|
293 |
} |
|
294 |
} |
|
295 |
} |
|
296 |
||
297 |
/* |
|
298 |
* AJAX login box (experimental) |
|
299 |
*/ |
|
300 |
||
301 |
var ajax_auth_prompt_cache = false; |
|
302 |
var ajax_auth_mb_cache = false; |
|
303 |
var ajax_auth_level_cache = false; |
|
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
304 |
var ajax_auth_error_string = false; |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
305 |
var ajax_auth_show_captcha = false; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
306 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
307 |
function ajaxAuthErrorToString($data) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
308 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
309 |
var $errstring = $data.error; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
310 |
// this was literally copied straight from the PHP code. |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
311 |
switch($data.error) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
312 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
313 |
case 'key_not_found': |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
314 |
$errstring = 'Enano couldn\'t look up the encryption key used to encrypt your password. This most often happens if a cache rotation occurred during your login attempt, or if you refreshed the login page.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
315 |
break; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
316 |
case 'key_wrong_length': |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
317 |
$errstring = 'The encryption key was the wrong length.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
318 |
break; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
319 |
case 'too_big_for_britches': |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
320 |
$errstring = 'You are trying to authenticate at a level that your user account does not permit.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
321 |
break; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
322 |
case 'invalid_credentials': |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
323 |
$errstring = 'You have entered an invalid username or password. Please enter your login details again.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
324 |
if ( $data.lockout_policy == 'lockout' ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
325 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
326 |
$errstring += ' You have used up '+$data['lockout_fails']+' out of '+$data['lockout_threshold']+' login attempts. After you have used up all '+$data['lockout_threshold']+' login attempts, you will be locked out from logging in for '+$data['lockout_duration']+' minutes.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
327 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
328 |
else if ( $data.lockout_policy == 'captcha' ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
329 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
330 |
$errstring += ' You have used up '+$data['lockout_fails']+' out of '+$data['lockout_threshold']+' login attempts. After you have used up all '+$data['lockout_threshold']+' login attempts, you will have to enter a visual confirmation code before logging in, effective for '+$data['lockout_duration']+' minutes.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
331 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
332 |
break; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
333 |
case 'backend_fail': |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
334 |
$errstring = 'You entered the right credentials and everything was validated, but for some reason Enano couldn\'t register your session. This is an internal problem with the site and you are encouraged to contact site administration.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
335 |
break; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
336 |
case 'locked_out': |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
337 |
$attempts = parseInt($data['lockout_fails']); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
338 |
if ( $attempts > $data['lockout_threshold']) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
339 |
$attempts = $data['lockout_threshold']; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
340 |
window.console.debug('server time ', $data.server_time, ', last time ', $data['lockout_last_time'], ', duration ', $data['lockout_duration']); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
341 |
$time_rem = $data.lockout_duration - Math.round( ( $data.server_time - $data.lockout_last_time ) / 60 ); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
342 |
$s = ( $time_rem == 1 ) ? '' : 's'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
343 |
$errstring = "You have used up all "+$data['lockout_threshold']+" allowed login attempts. Please wait "+$time_rem+" minute"+$s+" before attempting to log in again"; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
344 |
if ( $data['lockout_policy'] == 'captcha' ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
345 |
$errstring += ', or enter the visual confirmation code shown above in the appropriate box'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
346 |
$errstring += '.'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
347 |
break; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
348 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
349 |
return $errstring; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
350 |
} |
1 | 351 |
|
352 |
function ajaxPromptAdminAuth(call_on_ok, level) |
|
353 |
{ |
|
354 |
if ( typeof(call_on_ok) == 'function' ) |
|
355 |
{ |
|
356 |
ajax_auth_prompt_cache = call_on_ok; |
|
357 |
} |
|
358 |
if ( !level ) |
|
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
359 |
level = USER_LEVEL_MEMBER; |
1 | 360 |
ajax_auth_level_cache = level; |
361 |
var loading_win = '<div align="center" style="text-align: center;"> \ |
|
362 |
<p>Fetching an encryption key...</p> \ |
|
363 |
<p><small>Not working? Use the <a href="'+makeUrlNS('Special', 'Login/' + title)+'">alternate login form</a>.</p> \ |
|
364 |
<p><img alt="Please wait..." src="'+scriptPath+'/images/loading-big.gif" /></p> \ |
|
365 |
</div>'; |
|
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
366 |
var title = ( level > USER_LEVEL_MEMBER ) ? 'You are requesting a sensitive operation.' : 'Please enter your username and password to continue.'; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
367 |
ajax_auth_mb_cache = new messagebox(MB_OKCANCEL|MB_ICONLOCK, title, loading_win); |
1 | 368 |
ajax_auth_mb_cache.onbeforeclick['OK'] = ajaxValidateLogin; |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
369 |
ajax_auth_mb_cache.onbeforeclick['Cancel'] = function() |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
370 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
371 |
if ( document.getElementById('autoCaptcha') ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
372 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
373 |
var to = fly_out_top(document.getElementById('autoCaptcha'), false, true); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
374 |
setTimeout(function() { |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
375 |
var d = document.getElementById('autoCaptcha'); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
376 |
d.parentNode.removeChild(d); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
377 |
}, to); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
378 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
379 |
} |
1 | 380 |
ajaxAuthLoginInnerSetup(); |
381 |
} |
|
382 |
||
383 |
function ajaxAuthLoginInnerSetup() |
|
384 |
{ |
|
385 |
ajaxGet(makeUrlNS('Special', 'Login', 'act=getkey'), function() { |
|
386 |
if ( ajax.readyState == 4 ) |
|
387 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
9
diff
changeset
|
388 |
var response = String(ajax.responseText); |
1 | 389 |
if ( response.substr(0,1) != '{' ) |
390 |
{ |
|
391 |
alert('Invalid JSON response from server: ' + response); |
|
392 |
return false; |
|
393 |
} |
|
394 |
response = parseJSON(response); |
|
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
395 |
var disable_controls = false; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
396 |
if ( response.locked_out && !ajax_auth_error_string ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
397 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
398 |
response.error = 'locked_out'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
399 |
ajax_auth_error_string = ajaxAuthErrorToString(response); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
400 |
if ( response.lockout_policy == 'captcha' ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
401 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
402 |
ajax_auth_show_captcha = response.captcha; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
403 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
404 |
else |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
405 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
406 |
disable_controls = true; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
407 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
408 |
} |
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
409 |
var level = ajax_auth_level_cache; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
410 |
var form_html = ''; |
176 | 411 |
var shown_error = false; |
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
412 |
if ( ajax_auth_error_string ) |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
413 |
{ |
176 | 414 |
shown_error = true; |
415 |
form_html += '<div class="error-box-mini" id="ajax_auth_error">' + ajax_auth_error_string + '</div>'; |
|
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
416 |
ajax_auth_error_string = false; |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
417 |
} |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
418 |
else if ( level > USER_LEVEL_MEMBER ) |
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
419 |
{ |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
420 |
form_html += 'Please re-enter your login details, to verify your identity.<br /><br />'; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
421 |
} |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
422 |
if ( ajax_auth_show_captcha ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
423 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
424 |
var captcha_html = ' \ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
425 |
<tr> \ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
426 |
<td>Code in image:</td> \ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
427 |
<td><input type="hidden" id="ajaxlogin_captcha_hash" value="' + ajax_auth_show_captcha + '" /><input type="text" tabindex="3" size="25" id="ajaxlogin_captcha_code" /> \ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
428 |
</tr>'; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
429 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
430 |
else |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
431 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
432 |
var captcha_html = ''; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
433 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
434 |
var disableme = ( disable_controls ) ? 'disabled="disabled" ' : ''; |
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
435 |
form_html += ' \ |
1 | 436 |
<table border="0" align="center"> \ |
437 |
<tr> \ |
|
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
438 |
<td>Username:</td><td><input tabindex="1" id="ajaxlogin_user" type="text" ' + disableme + 'size="25" /> \ |
1 | 439 |
</tr> \ |
440 |
<tr> \ |
|
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
441 |
<td>Password:</td><td><input tabindex="2" id="ajaxlogin_pass" type="password" ' + disableme + 'size="25" /> \ |
1 | 442 |
</tr> \ |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
443 |
' + captcha_html + ' \ |
1 | 444 |
<tr> \ |
445 |
<td colspan="2" style="text-align: center;"> \ |
|
176 | 446 |
<br /><small>Trouble logging in? Try the <a href="'+makeUrlNS('Special', 'Login/' + title, 'level=' + level)+'">full login form</a>.<br />'; |
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
447 |
if ( level <= USER_LEVEL_MEMBER ) |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
448 |
{ |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
449 |
form_html += ' \ |
1 | 450 |
Did you <a href="'+makeUrlNS('Special', 'PasswordReset')+'">forget your password</a>?<br /> \ |
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
451 |
Maybe you need to <a href="'+makeUrlNS('Special', 'Register')+'">create an account</a>.</small>'; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
452 |
} |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
453 |
form_html += ' \ |
1 | 454 |
</td> \ |
455 |
</tr> \ |
|
456 |
</table> \ |
|
457 |
<input type="hidden" id="ajaxlogin_crypt_key" value="' + response.key + '" /> \ |
|
458 |
<input type="hidden" id="ajaxlogin_crypt_challenge" value="' + response.challenge + '" /> \ |
|
459 |
</form>'; |
|
460 |
ajax_auth_mb_cache.updateContent(form_html); |
|
461 |
$('messageBox').object.nextSibling.firstChild.tabindex = '3'; |
|
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
462 |
if ( typeof(response.username) == 'string' ) |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
463 |
{ |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
464 |
$('ajaxlogin_user').object.value = response.username; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
465 |
$('ajaxlogin_pass').object.focus(); |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
466 |
} |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
467 |
else |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
468 |
{ |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
469 |
$('ajaxlogin_user').object.focus(); |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
40
diff
changeset
|
470 |
} |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
471 |
if ( ajax_auth_show_captcha ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
472 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
473 |
$('ajaxlogin_captcha_code').object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); }; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
474 |
$('ajaxlogin_captcha_code').object.onkeypress = function(e) { if ( !e && IE ) return true; if ( e.keyCode == 13 ) $('messageBox').object.nextSibling.firstChild.click(); }; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
475 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
476 |
else |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
477 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
478 |
$('ajaxlogin_pass').object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); }; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
479 |
$('ajaxlogin_pass').object.onkeypress = function(e) { if ( !e && IE ) return true; if ( e.keyCode == 13 ) $('messageBox').object.nextSibling.firstChild.click(); }; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
480 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
481 |
if ( disable_controls ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
482 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
483 |
var panel = document.getElementById('messageBoxButtons'); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
484 |
panel.firstChild.disabled = true; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
485 |
} |
176 | 486 |
/* |
487 |
## This causes the background image to disappear under Fx 2 |
|
488 |
if ( shown_error ) |
|
489 |
{ |
|
490 |
// fade to #FFF4F4 |
|
491 |
var fader = new Spry.Effect.Highlight('ajax_auth_error', {duration: 1000, from: '#FFF4F4', to: '#805600', restoreColor: '#805600', finish: function() |
|
492 |
{ |
|
493 |
var fader = new Spry.Effect.Highlight('ajax_auth_error', {duration: 3000, from: '#805600', to: '#FFF4F4', restoreColor: '#FFF4F4'}); |
|
494 |
fader.start(); |
|
495 |
}}); |
|
496 |
fader.start(); |
|
497 |
} |
|
498 |
*/ |
|
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
499 |
if ( ajax_auth_show_captcha ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
500 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
501 |
ajaxShowCaptcha(ajax_auth_show_captcha); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
502 |
ajax_auth_show_captcha = false; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
503 |
} |
1 | 504 |
} |
505 |
}); |
|
506 |
} |
|
507 |
||
508 |
function ajaxValidateLogin() |
|
509 |
{ |
|
510 |
var username,password,auth_enabled,crypt_key,crypt_data,challenge_salt,challenge_data; |
|
511 |
username = document.getElementById('ajaxlogin_user'); |
|
512 |
if ( !username ) |
|
513 |
return false; |
|
514 |
username = document.getElementById('ajaxlogin_user').value; |
|
515 |
password = document.getElementById('ajaxlogin_pass').value; |
|
516 |
auth_enabled = false; |
|
517 |
||
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
518 |
if ( document.getElementById('autoCaptcha') ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
519 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
520 |
var to = fly_out_top(document.getElementById('autoCaptcha'), false, true); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
521 |
setTimeout(function() { |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
522 |
var d = document.getElementById('autoCaptcha'); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
523 |
d.parentNode.removeChild(d); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
524 |
}, to); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
525 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
526 |
|
1 | 527 |
disableJSONExts(); |
528 |
||
529 |
// |
|
530 |
// Encryption test |
|
531 |
// |
|
532 |
||
533 |
var str = ''; |
|
534 |
for(i=0;i<keySizeInBits/4;i++) |
|
535 |
{ |
|
536 |
str+='0'; |
|
537 |
} |
|
538 |
str = hexToByteArray(str); |
|
539 |
var ct = rijndaelEncrypt(str, str, 'ECB'); |
|
540 |
ct = byteArrayToHex(ct); |
|
541 |
var v; |
|
542 |
switch(keySizeInBits) |
|
543 |
{ |
|
544 |
case 128: |
|
545 |
v = '66e94bd4ef8a2c3b884cfa59ca342b2e'; |
|
546 |
break; |
|
547 |
case 192: |
|
548 |
v = 'aae06992acbf52a3e8f4a96ec9300bd7aae06992acbf52a3e8f4a96ec9300bd7'; |
|
549 |
break; |
|
550 |
case 256: |
|
551 |
v = 'dc95c078a2408989ad48a21492842087dc95c078a2408989ad48a21492842087'; |
|
552 |
break; |
|
553 |
} |
|
554 |
auth_enabled = ( ct == v && md5_vm_test() ); |
|
555 |
if ( !auth_enabled ) |
|
556 |
{ |
|
557 |
alert('Login error: encryption sanity check failed\n'); |
|
558 |
return true; |
|
559 |
} |
|
560 |
||
561 |
crypt_key = document.getElementById('ajaxlogin_crypt_key').value; |
|
562 |
challenge_salt = document.getElementById('ajaxlogin_crypt_challenge').value; |
|
563 |
||
564 |
var crypt_key_md5 = hex_md5(crypt_key); |
|
565 |
||
566 |
challenge_data = hex_md5(password + challenge_salt) + challenge_salt; |
|
567 |
||
568 |
password = stringToByteArray(password); |
|
569 |
crypt_key = hexToByteArray(crypt_key); |
|
570 |
||
571 |
crypt_data = rijndaelEncrypt(password, crypt_key, 'ECB'); |
|
572 |
crypt_data = byteArrayToHex(crypt_data); |
|
573 |
||
574 |
var json_data = { |
|
575 |
'username' : username, |
|
576 |
'crypt_key' : crypt_key_md5, |
|
577 |
'challenge' : challenge_data, |
|
578 |
'crypt_data' : crypt_data, |
|
579 |
'level' : ajax_auth_level_cache |
|
580 |
}; |
|
581 |
||
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
582 |
if ( document.getElementById('ajaxlogin_captcha_hash') ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
583 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
584 |
json_data.captcha_hash = document.getElementById('ajaxlogin_captcha_hash').value; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
585 |
json_data.captcha_code = document.getElementById('ajaxlogin_captcha_code').value; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
586 |
} |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
587 |
|
1 | 588 |
json_data = toJSONString(json_data); |
135
c5dbad7ec2d0
Enano should now fully support UTF-8 usernames; newly registered users are now granted automatic edit access to their user pages (admins can still use protection on the page)
Dan
parents:
133
diff
changeset
|
589 |
json_data = encodeURIComponent(json_data); |
1 | 590 |
|
591 |
var loading_win = '<div align="center" style="text-align: center;"> \ |
|
592 |
<p>Logging in...</p> \ |
|
593 |
<p><img alt="Please wait..." src="'+scriptPath+'/images/loading-big.gif" /></p> \ |
|
594 |
</div>'; |
|
595 |
||
596 |
ajax_auth_mb_cache.updateContent(loading_win); |
|
597 |
||
598 |
ajaxPost(makeUrlNS('Special', 'Login', 'act=ajaxlogin'), 'params=' + json_data, function() { |
|
599 |
if ( ajax.readyState == 4 ) |
|
600 |
{ |
|
601 |
var response = ajax.responseText; |
|
602 |
if ( response.substr(0,1) != '{' ) |
|
603 |
{ |
|
604 |
alert('Invalid JSON response from server: ' + response); |
|
605 |
ajaxAuthLoginInnerSetup(); |
|
606 |
return false; |
|
607 |
} |
|
608 |
response = parseJSON(response); |
|
609 |
switch(response.result) |
|
610 |
{ |
|
611 |
case 'success': |
|
612 |
if ( typeof(ajax_auth_prompt_cache) == 'function' ) |
|
613 |
{ |
|
614 |
ajax_auth_prompt_cache(response.key); |
|
615 |
} |
|
616 |
break; |
|
617 |
case 'success_reset': |
|
618 |
var conf = confirm('You have logged in using a temporary password. Before you can log in, you must finish resetting your password. Do you want to reset your real password now?'); |
|
619 |
if ( conf ) |
|
620 |
{ |
|
621 |
var url = makeUrlNS('Special', 'PasswordReset/stage2/' + response.user_id + '/' + response.temppass); |
|
622 |
window.location = url; |
|
623 |
} |
|
624 |
else |
|
625 |
{ |
|
626 |
ajaxAuthLoginInnerSetup(); |
|
627 |
} |
|
628 |
break; |
|
629 |
case 'error': |
|
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
630 |
if ( response.data.error == 'invalid_credentials' || response.data.error == 'locked_out' ) |
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
631 |
{ |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
632 |
ajax_auth_error_string = ajaxAuthErrorToString(response.data); |
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
633 |
mb_current_obj.updateContent(''); |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
634 |
document.getElementById('messageBox').style.backgroundColor = '#C0C0C0'; |
175
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
174
diff
changeset
|
635 |
var mb_parent = document.getElementById('messageBox').parentNode; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
174
diff
changeset
|
636 |
new Spry.Effect.Shake(mb_parent, {duration: 1500}).start(); |
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
637 |
setTimeout("document.getElementById('messageBox').style.backgroundColor = '#FFF'; ajaxAuthLoginInnerSetup();", 2500); |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
638 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
639 |
if ( response.data.lockout_policy == 'captcha' && response.data.error == 'locked_out' ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
640 |
{ |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
641 |
ajax_auth_show_captcha = response.captcha; |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
642 |
} |
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
643 |
} |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
644 |
else |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
645 |
{ |
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
176
diff
changeset
|
646 |
ajax_auth_error_string = ajaxAuthErrorToString(response.data); |
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
647 |
ajaxAuthLoginInnerSetup(); |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
144
diff
changeset
|
648 |
} |
1 | 649 |
break; |
650 |
default: |
|
651 |
alert(ajax.responseText); |
|
652 |
break; |
|
653 |
} |
|
654 |
} |
|
655 |
}); |
|
656 |
||
657 |
return true; |
|
658 |
||
659 |
} |
|
660 |
||
661 |
// This code is in the public domain. Feel free to link back to http://jan.moesen.nu/ |
|
662 |
function sprintf() |
|
663 |
{ |
|
664 |
if (!arguments || arguments.length < 1 || !RegExp) |
|
665 |
{ |
|
666 |
return; |
|
667 |
} |
|
668 |
var str = arguments[0]; |
|
669 |
var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/; |
|
670 |
var a = b = [], numSubstitutions = 0, numMatches = 0; |
|
671 |
while (a = re.exec(str)) |
|
672 |
{ |
|
673 |
var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4]; |
|
674 |
var pPrecision = a[5], pType = a[6], rightPart = a[7]; |
|
675 |
||
676 |
//alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision); |
|
677 |
||
678 |
numMatches++; |
|
679 |
if (pType == '%') |
|
680 |
{ |
|
681 |
subst = '%'; |
|
682 |
} |
|
683 |
else |
|
684 |
{ |
|
685 |
numSubstitutions++; |
|
686 |
if (numSubstitutions >= arguments.length) |
|
687 |
{ |
|
688 |
alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).'); |
|
689 |
} |
|
690 |
var param = arguments[numSubstitutions]; |
|
691 |
var pad = ''; |
|
692 |
if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1); |
|
693 |
else if (pPad) pad = pPad; |
|
694 |
var justifyRight = true; |
|
695 |
if (pJustify && pJustify === "-") justifyRight = false; |
|
696 |
var minLength = -1; |
|
697 |
if (pMinLength) minLength = parseInt(pMinLength); |
|
698 |
var precision = -1; |
|
699 |
if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1)); |
|
700 |
var subst = param; |
|
701 |
if (pType == 'b') subst = parseInt(param).toString(2); |
|
702 |
else if (pType == 'c') subst = String.fromCharCode(parseInt(param)); |
|
703 |
else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0; |
|
704 |
else if (pType == 'u') subst = Math.abs(param); |
|
705 |
else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param); |
|
706 |
else if (pType == 'o') subst = parseInt(param).toString(8); |
|
707 |
else if (pType == 's') subst = param; |
|
708 |
else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase(); |
|
709 |
else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase(); |
|
710 |
} |
|
711 |
str = leftpart + subst + rightPart; |
|
712 |
} |
|
713 |
return str; |
|
714 |
} |
|
715 |
||
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
716 |
/** |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
717 |
* Insert a DOM object _after_ the specified child. |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
718 |
* @param object Parent node |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
719 |
* @param object Node to insert |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
720 |
* @param object Node to insert after |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
721 |
*/ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
722 |
|
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
723 |
function insertAfter(parent, baby, bigsister) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
724 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
725 |
try |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
726 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
727 |
if ( parent.childNodes[parent.childNodes.length-1] == bigsister ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
728 |
parent.appendChild(baby); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
729 |
else |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
730 |
parent.insertBefore(baby, bigsister.nextSibling); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
731 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
732 |
catch(e) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
733 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
734 |
alert(e.toString()); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
735 |
if ( window.console ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
736 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
737 |
// Firebug support |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
738 |
window.console.warn(e); |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
739 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
740 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
741 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
60
diff
changeset
|
742 |
|
125
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
743 |
/** |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
744 |
* Validates an e-mail address. |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
745 |
* @param string E-mail address |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
746 |
* @return bool |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
747 |
*/ |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
748 |
|
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
749 |
function validateEmail(email) |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
750 |
{ |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
751 |
return ( email.match(/^(?:[\w\d]+\.?)+@((?:(?:[\w\d]\-?)+\.)+\w{2,4}|localhost)$/) ) ? true : false; |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
752 |
} |
fb31c951d3a2
Fixed some rather major bugs in the registration system, this will need a release followup
Dan
parents:
85
diff
changeset
|
753 |