This commit is contained in:
parent
7963613cd3
commit
36acd0ff06
@ -49,9 +49,13 @@ function recoveraccounts(callback) {
|
||||
/**
|
||||
* Switch to a different account.
|
||||
* @param {int} account The selected account index from localStorage.getItem('accounts')
|
||||
* @param {boolean} showmsg Whether to show the "switched accounts" alert dialog. Default True.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function switchaccount(account) {
|
||||
function switchaccount(account, showmsg) {
|
||||
if (typeof showmsg != 'boolean') {
|
||||
showmsg = true;
|
||||
}
|
||||
// If there isn't an accounts list yet, this shouldi take us back to the setup
|
||||
if (!isconfigvalid()) {
|
||||
restartApplication();
|
||||
@ -69,8 +73,10 @@ function switchaccount(account) {
|
||||
accountid = account;
|
||||
|
||||
restartApplication();
|
||||
if (showmsg == true) {
|
||||
navigator.notification.alert("Successfully switched accounts.", null, "Switched", 'OK');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an Apps account.
|
||||
|
@ -11,6 +11,7 @@ setupsynckey = "";
|
||||
setupsyncurl = "";
|
||||
|
||||
netsymscomurl = "https://account.netsyms.com/mobile/index.php";
|
||||
netsymsbizurl = "https://BIZID.netsyms.biz/accounthub/mobile/index.php";
|
||||
|
||||
if (localStorage.getItem("firstrun") === null) {
|
||||
$("#setuptitle").text("Setup");
|
||||
@ -116,7 +117,7 @@ function personalsetup() {
|
||||
if (result.status == "OK") {
|
||||
var code = result.code;
|
||||
var accid = addaccount(username, password, netsymscomurl, code);
|
||||
switchaccount(accid);
|
||||
switchaccount(accid, false);
|
||||
localStorage.setItem("firstrun", "1");
|
||||
navigator.notification.alert("Account connected!", null, "Success", 'Continue');
|
||||
restartApplication();
|
||||
@ -131,6 +132,39 @@ function personalsetup() {
|
||||
});
|
||||
}
|
||||
|
||||
function businesssetup() {
|
||||
app.preloader.show();
|
||||
var username = $("#personal_username").val();
|
||||
var password = $("#personal_password").val();
|
||||
var url = netsymsbizurl.replace("BIZID", $("#bizid").val());
|
||||
|
||||
$.post(url, {
|
||||
username: username,
|
||||
password: password,
|
||||
key: "NOKEY",
|
||||
desc: device.platform + " " + device.model + " " + device.serial,
|
||||
action: "generatesynccode"
|
||||
}, function (result) {
|
||||
app.preloader.hide();
|
||||
if (result.status == "OK") {
|
||||
var code = result.code;
|
||||
var accid = addaccount(username, password, url, code);
|
||||
switchaccount(accid, false);
|
||||
localStorage.setItem("firstrun", "1");
|
||||
navigator.notification.alert("Account connected!", null, "Success", 'Continue');
|
||||
restartApplication();
|
||||
} else if (result.status == "ERROR") {
|
||||
navigator.notification.alert(result.msg, null, "Error", 'Dismiss');
|
||||
} else {
|
||||
navigator.notification.alert("Something went wrong, please try again.", null, "Error", 'Dismiss');
|
||||
}
|
||||
}, "json").fail(function () {
|
||||
app.preloader.hide();
|
||||
navigator.notification.alert("Something went wrong, please try again.", null, "Error", 'Dismiss');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function scanCode() {
|
||||
try {
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
|
@ -15,7 +15,7 @@ function savePassword() {
|
||||
if (data.status === 'OK') {
|
||||
setuppassword = $('#passbox').val();
|
||||
var accid = addaccount(setupusername, setuppassword, setupsyncurl, setupsynckey);
|
||||
switchaccount(accid);
|
||||
switchaccount(accid, false);
|
||||
localStorage.setItem("firstrun", "1");
|
||||
navigator.notification.alert("Account connected!", null, "Success", 'Continue');
|
||||
restartApplication();
|
||||
|
@ -27,7 +27,8 @@
|
||||
<li>
|
||||
<a href="#" class="item-link" onclick='router.navigate("/setup/1", {
|
||||
context: {
|
||||
personal: true
|
||||
personal: true,
|
||||
business: false
|
||||
}
|
||||
});'>
|
||||
<div class="item-content">
|
||||
@ -46,7 +47,12 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/setup/1" class="item-link">
|
||||
<a href="#" class="item-link" onclick='router.navigate("/setup/1", {
|
||||
context: {
|
||||
personal: false,
|
||||
business: true
|
||||
}
|
||||
});'>
|
||||
<div class="item-content">
|
||||
<div class="item-media">
|
||||
<img src="img/accounticons/business.svg" width="44"/>
|
||||
|
@ -19,10 +19,15 @@
|
||||
<div class="page-content">
|
||||
|
||||
<div class="block">
|
||||
{{#if personal}}
|
||||
{{#js_if "this.personal == true || this.business == true"}}
|
||||
<div class="card">
|
||||
<div class="card-content card-content-padding">
|
||||
{{#if personal}}
|
||||
<p>Type your netsyms.com username and password.</p>
|
||||
{{/if}}
|
||||
{{#if business}}
|
||||
<p>Type your netsyms.biz username, password, and business ID.</p>
|
||||
{{/if}}
|
||||
|
||||
<div class="list no-hairlines">
|
||||
<ul>
|
||||
@ -45,18 +50,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
{{#if business}}
|
||||
<li class="item-content item-input">
|
||||
<div class="item-inner">
|
||||
<div class="item-title item-floating-label">Business ID (____.netsyms.biz)</div>
|
||||
<div class="item-input-wrap">
|
||||
<input type="text" id="bizid" placeholder="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
|
||||
<span class="input-clear-button"></span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="button button-fill button-raised button-round" onclick="personalsetup()">
|
||||
<div class="button button-fill button-raised button-round" onclick="{{#if personal}}personalsetup(){{else}}businesssetup(){{/if}}">
|
||||
Continue
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p style="text-align: center; font-size: 120%;">- or -</p>
|
||||
{{/if}}
|
||||
{{/js_if}}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-content card-content-padding">
|
||||
|
Loading…
x
Reference in New Issue
Block a user