You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MobileApp/www/js/setup2.js

28 lines
1.1 KiB
JavaScript

/*
* 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');
});
}