/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ function savePassword() { $.post(setupsyncurl, { username: setupusername, key: setupsynckey, password: $('#passbox').val(), action: "check_password" }, function (data) { if (data.status === 'OK') { setuppassword = $('#passbox').val(); var accid = addaccount(setupusername, setuppassword, setupsyncurl, setupsynckey); switchaccount(accid, false); localStorage.setItem("firstrun", "1"); navigator.notification.alert("Account connected!", null, "Success", 'Continue'); restartApplication(); } else { navigator.notification.alert(data.msg, null, "Error", 'Dismiss'); } }, "json").fail(function () { navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss'); }); }