diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index b68114d1..80fc237f 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -270,7 +270,9 @@ function jappixmini_settings(&$a, &$s) { if (friendica_password) { jappixmini_addon_set_client_secret(friendica_password.value); - password.value = jappixmini_addon_encrypt_password(clear_password.value); + jappixmini_addon_encrypt_password(clear_password.value, function(encrypted_password){ + password.value = encrypted_password; + }); } } else { @@ -283,7 +285,9 @@ function jappixmini_settings(&$a, &$s) { password = document.getElementById('jappixmini-password'); clear_password = document.getElementById('jappixmini-clear-password'); if (encrypt) { - clear_password.value = jappixmini_addon_decrypt_password(password.value); + jappixmini_addon_decrypt_password(password.value, function(decrypted_password){ + clear_password.value = decrypted_password; + }); } else { clear_password.value = password.value; diff --git a/jappixmini/lib.js b/jappixmini/lib.js index 610a8312..94e465d1 100644 --- a/jappixmini/lib.js +++ b/jappixmini/lib.js @@ -24,59 +24,71 @@ function jappixmini_addon_set_client_secret(password) { client_secret2 = str_sha1(salt2+password); client_secret = client_secret1 + client_secret2; - setDB('jappix-mini', 'client_secret', client_secret); + setDB('jappix-mini', 'client-secret', client_secret); console.log("client secret set"); } -function jappixmini_addon_get_client_secret() { - client_secret = getDB('jappix-mini', 'client_secret'); +function jappixmini_addon_get_client_secret(callback) { + client_secret = getDB('jappix-mini', 'client-secret'); if (client_secret===null) { - div = $('