Rev 149 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 149 | Rev 150 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | return btoa(String.fromCharCode.apply(null, |
21 | return btoa(String.fromCharCode.apply(null, |
22 | str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))); |
22 | str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))); |
23 | } |
23 | } |
24 | 24 | ||
25 | function rehash_admin_pwd() { |
25 | function rehash_admin_pwd() { |
- | 26 | var error = ""; |
|
- | 27 | ||
- | 28 | if (document.getElementById('admin_password').value.length == 0) { |
|
- | 29 | document.getElementById('config').innerHTML = ""; |
|
- | 30 | return; |
|
- | 31 | } |
|
- | 32 | ||
26 | if (document.getElementById('admin_password').value.length < min_password_length) { |
33 | if (document.getElementById('admin_password').value.length < min_password_length) { |
27 | document.getElementById('config').innerHTML = 'Password too short. Need at least '+min_password_length+' characters<br>'; |
34 | error += 'Password too short. Need at least '+min_password_length+' characters<br>'; |
- | 35 | } |
|
- | 36 | ||
- | 37 | if (document.getElementById('admin_password').value != document.getElementById('admin_password2').value) { |
|
- | 38 | error += 'Passwords do not match.<br>'; |
|
- | 39 | } |
|
- | 40 | ||
- | 41 | if (error != "") { |
|
- | 42 | document.getElementById('config').innerHTML = error; |
|
28 | } else { |
43 | } else { |
29 | document.getElementById('config').innerHTML = '<b>define</b>(\'OIDPLUS_ADMIN_PASSWORD\', \'' + hexToBase64(sha3_512(document.getElementById('admin_password').value)) + '\'); // base64 encoded SHA3-512 hash<br>'; |
44 | document.getElementById('config').innerHTML = '<b>define</b>(\'OIDPLUS_ADMIN_PASSWORD\', \'' + hexToBase64(sha3_512(document.getElementById('admin_password').value)) + '\'); // base64 encoded SHA3-512 hash<br>'; |
30 | } |
45 | } |
31 | } |
46 | } |