|
|
|
@ -8,7 +8,7 @@ $('#username').on("keyup", function () {
|
|
|
|
|
$('#username').val($('#username').val().toLowerCase());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function checkAndSave(username, password, type) {
|
|
|
|
|
function checkAndSave(username, password) {
|
|
|
|
|
app.preloader.show();
|
|
|
|
|
|
|
|
|
|
callAPI("getkey", {
|
|
|
|
@ -19,10 +19,29 @@ function checkAndSave(username, password, type) {
|
|
|
|
|
localStorage.setItem("key", data.key);
|
|
|
|
|
localStorage.setItem("username", username);
|
|
|
|
|
localStorage.setItem("password", password);
|
|
|
|
|
localStorage.setItem("accttype", type);
|
|
|
|
|
localStorage.setItem("configured", true);
|
|
|
|
|
// Restart the app to re-read the config
|
|
|
|
|
restartApplication();
|
|
|
|
|
callAPI("getprofile", {
|
|
|
|
|
key: data.key
|
|
|
|
|
}, function (profile) {
|
|
|
|
|
if (profile.profile.type == 1) {
|
|
|
|
|
localStorage.setItem("accttype", "giver");
|
|
|
|
|
} else if (profile.profile.type == 2) {
|
|
|
|
|
localStorage.setItem("accttype", "receiver");
|
|
|
|
|
} else if (profile.profile.type == 3){
|
|
|
|
|
app.preloader.hide();
|
|
|
|
|
app.dialog.alert("You need to download the merchant app instead. Visit ntsm.co/contact if you need help.", "Error");
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
app.preloader.hide();
|
|
|
|
|
app.dialog.alert("Server replied with unknown account type. You might need to update this app.", "Error");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
localStorage.setItem("configured", true);
|
|
|
|
|
// Restart the app to re-read the config
|
|
|
|
|
restartApplication();
|
|
|
|
|
}, function (msg) {
|
|
|
|
|
app.preloader.hide();
|
|
|
|
|
app.dialog.alert(msg, "Error");
|
|
|
|
|
});
|
|
|
|
|
}, function (msg) {
|
|
|
|
|
app.preloader.hide();
|
|
|
|
|
app.dialog.alert(msg, "Error");
|
|
|
|
|