瀏覽代碼

Bugfix. Handle case where pass_check is undefined.

JC Brand 11 年之前
父節點
當前提交
84e28a33b8
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      converse.js

+ 3 - 2
converse.js

@@ -449,11 +449,12 @@
                 var instance_tag = window.sessionStorage[hex_sha1(this.id+'instance_tag')];
                 var cipher = crypto.lib.PasswordBasedCipher;
                 var pass = converse.connection.pass;
+                var pass_check = this.get('pass_check');
                 var result, key;
-                if (saved_key && instance_tag) {
+                if (saved_key && instance_tag && typeof pass_check !== undefined) {
                     var decrypted = cipher.decrypt(crypto.algo.AES, saved_key, pass);
                     key = otr.DSA.parsePrivate(decrypted.toString(crypto.enc.Latin1));
-                    if (cipher.decrypt(crypto.algo.AES, this.get('pass_check'), pass).toString(crypto.enc.Latin1) === 'match') {
+                    if (cipher.decrypt(crypto.algo.AES, pass_check, pass).toString(crypto.enc.Latin1) === 'match') {
                         // Verified that the user's password is still the same
                         this.trigger('showHelpMessages', [__('Re-establishing encrypted session')]);
                         return {