summaryrefslogtreecommitdiff
path: root/p/scripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'p/scripts/main.js')
-rw-r--r--p/scripts/main.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index d891299a8..d775b3a20 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -626,14 +626,18 @@ function init_loginForm() {
if (data.salt1 == '' || data.nonce == '') {
alert('Invalid user!');
} else {
- var strong = window.Uint32Array && window.crypto && (typeof window.crypto.getRandomValues === 'function'),
- s = dcodeIO.bcrypt.hashSync($('#passwordPlain').val(), data.salt1),
- c = dcodeIO.bcrypt.hashSync(data.nonce + s, strong ? 4 : poormanSalt());
- $('#challenge').val(c);
- if (s == '' || c == '') {
- alert('Crypto error!');
- } else {
- success = true;
+ try {
+ var strong = window.Uint32Array && window.crypto && (typeof window.crypto.getRandomValues === 'function'),
+ s = dcodeIO.bcrypt.hashSync($('#passwordPlain').val(), data.salt1),
+ c = dcodeIO.bcrypt.hashSync(data.nonce + s, strong ? 4 : poormanSalt());
+ $('#challenge').val(c);
+ if (s == '' || c == '') {
+ alert('Crypto error!');
+ } else {
+ success = true;
+ }
+ } catch (e) {
+ alert('Crypto exception! ' + e);
}
}
}).fail(function() {