Separate account number from phone number
This commit is contained in:
parent
04e4811437
commit
8fc4879410
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
|
|
||||||
function checkAccountStatus(callback) {
|
function checkAccountStatus(callback) {
|
||||||
if (inStorage("phonenumber")) {
|
if (inStorage("accountnumber")) {
|
||||||
apirequest(SETTINGS.apis.authorstartverify, {
|
apirequest(SETTINGS.apis.authorstartverify, {
|
||||||
phone: getStorage("phonenumber"),
|
accountnumber: getStorage("accountnumber"),
|
||||||
accountkey: (inStorage("accountkey") ? getStorage("accountkey") : "")
|
accountkey: (inStorage("accountkey") ? getStorage("accountkey") : "")
|
||||||
}, function (resp) {
|
}, function (resp) {
|
||||||
if (resp.status == "OK") {
|
if (resp.status == "OK") {
|
||||||
@ -27,7 +27,7 @@ function checkAccountStatus(callback) {
|
|||||||
router.back();
|
router.back();
|
||||||
// Server is saying something's wrong, let's clear the account number in case
|
// Server is saying something's wrong, let's clear the account number in case
|
||||||
// the user wants to try a different one.
|
// the user wants to try a different one.
|
||||||
removeFromStorage("phonenumber");
|
removeFromStorage("accountnumber");
|
||||||
app.dialog.alert(resp.msg, "Error");
|
app.dialog.alert(resp.msg, "Error");
|
||||||
}
|
}
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
@ -40,12 +40,12 @@ function checkAccountStatus(callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkIfAccountGoodWithPaymentMethod(successcb, errorcb) {
|
function checkIfAccountGoodWithPaymentMethod(successcb, errorcb) {
|
||||||
if (!inStorage("phonenumber") || !inStorage("accountkey")) {
|
if (!inStorage("accountnumber") || !inStorage("accountkey")) {
|
||||||
successcb(false);
|
successcb(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
apirequest(SETTINGS.apis.getaccountinfo, {
|
apirequest(SETTINGS.apis.getaccountinfo, {
|
||||||
phone: getStorage("phonenumber"),
|
accountnumber: getStorage("accountnumber"),
|
||||||
accountkey: getStorage("accountkey")
|
accountkey: getStorage("accountkey")
|
||||||
}, function (success) {
|
}, function (success) {
|
||||||
if (success.status == "OK") {
|
if (success.status == "OK") {
|
||||||
@ -79,7 +79,7 @@ function verifyCode(code) {
|
|||||||
app.dialog.preloader("Verifying...");
|
app.dialog.preloader("Verifying...");
|
||||||
apirequest(SETTINGS.apis.verifyauthcode, {
|
apirequest(SETTINGS.apis.verifyauthcode, {
|
||||||
code: code,
|
code: code,
|
||||||
phone: getStorage("phonenumber")
|
accountnumber: getStorage("accountnumber")
|
||||||
}, function (resp) {
|
}, function (resp) {
|
||||||
app.dialog.close();
|
app.dialog.close();
|
||||||
if (resp.status == "OK") {
|
if (resp.status == "OK") {
|
||||||
@ -98,13 +98,13 @@ function verifyCode(code) {
|
|||||||
function displayAccountInfo() {
|
function displayAccountInfo() {
|
||||||
$("#loyaltyBalanceBox").addClass("display-none");
|
$("#loyaltyBalanceBox").addClass("display-none");
|
||||||
$("#loyaltyErrorMessage").html("");
|
$("#loyaltyErrorMessage").html("");
|
||||||
if (inStorage("accountkey") && inStorage("phonenumber")) {
|
if (inStorage("accountkey") && inStorage("accountnumber")) {
|
||||||
} else {
|
} else {
|
||||||
$("#loyaltyErrorMessage").text("Error: No account connected.");
|
$("#loyaltyErrorMessage").text("Error: No account connected.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
apirequest(SETTINGS.apis.getaccountinfo, {
|
apirequest(SETTINGS.apis.getaccountinfo, {
|
||||||
phone: getStorage("phonenumber"),
|
accountnumber: getStorage("accountnumber"),
|
||||||
accountkey: getStorage("accountkey")
|
accountkey: getStorage("accountkey")
|
||||||
}, function (success) {
|
}, function (success) {
|
||||||
$("#hasaccountbox").css("display", "");
|
$("#hasaccountbox").css("display", "");
|
||||||
@ -112,7 +112,7 @@ function displayAccountInfo() {
|
|||||||
if (success.status == "OK") {
|
if (success.status == "OK") {
|
||||||
$("#loyaltyCreditBalanceHeading").text(success.credits + " points");
|
$("#loyaltyCreditBalanceHeading").text(success.credits + " points");
|
||||||
$("#loyaltyBalanceBox").removeClass("display-none")
|
$("#loyaltyBalanceBox").removeClass("display-none")
|
||||||
$("#accountnumberspan").text(success.phone);
|
$("#accountnumberspan").text(success.accountnumber);
|
||||||
|
|
||||||
if (success.payments_setup === false) {
|
if (success.payments_setup === false) {
|
||||||
$("#addPaymentMethodBox").css("display", "");
|
$("#addPaymentMethodBox").css("display", "");
|
||||||
@ -121,6 +121,7 @@ function displayAccountInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$("#accountupdateform input#name").val(success.name);
|
$("#accountupdateform input#name").val(success.name);
|
||||||
|
$("#accountupdateform input#phone").val(success.phone);
|
||||||
$("#accountupdateform input#email").val(success.email);
|
$("#accountupdateform input#email").val(success.email);
|
||||||
$("#accountupdateform input#streetaddress").val(success.streetaddress);
|
$("#accountupdateform input#streetaddress").val(success.streetaddress);
|
||||||
$("#accountupdateform input#zipcode").val(success.zipcode);
|
$("#accountupdateform input#zipcode").val(success.zipcode);
|
||||||
@ -168,7 +169,7 @@ $("body").on("click", "#setupAccountBtn", function () {
|
|||||||
app.dialog.alert(resp.msg, "Error");
|
app.dialog.alert(resp.msg, "Error");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
setStorage("phonenumber", resp.phone);
|
setStorage("accountnumber", resp.accountnumber);
|
||||||
router.refreshPage();
|
router.refreshPage();
|
||||||
}
|
}
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
@ -196,9 +197,10 @@ $("body").on("click", "#updateAccountBtn", function () {
|
|||||||
}
|
}
|
||||||
app.dialog.preloader("Updating Account...");
|
app.dialog.preloader("Updating Account...");
|
||||||
apirequest(SETTINGS.apis.accountregister, {
|
apirequest(SETTINGS.apis.accountregister, {
|
||||||
phone: getStorage("phonenumber"),
|
accountnumber: getStorage("accountnumber"),
|
||||||
accountkey: getStorage("accountkey"),
|
accountkey: getStorage("accountkey"),
|
||||||
name: $("#accountupdateform input#name").val(),
|
name: $("#accountupdateform input#name").val(),
|
||||||
|
phone: $("#accountupdateform input#phone").val(),
|
||||||
email: $("#accountupdateform input#email").val(),
|
email: $("#accountupdateform input#email").val(),
|
||||||
address: $("#accountupdateform input#streetaddress").val(),
|
address: $("#accountupdateform input#streetaddress").val(),
|
||||||
zipcode: $("#accountupdateform input#zipcode").val()
|
zipcode: $("#accountupdateform input#zipcode").val()
|
||||||
@ -210,7 +212,7 @@ $("body").on("click", "#updateAccountBtn", function () {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
app.popup.close("#accountUpdatePopup", true);
|
app.popup.close("#accountUpdatePopup", true);
|
||||||
setStorage("phonenumber", resp.phone);
|
setStorage("accountnumber", resp.accountnumber);
|
||||||
router.refreshPage();
|
router.refreshPage();
|
||||||
app.dialog.alert("Account details updated.", "Account Updated");
|
app.dialog.alert("Account details updated.", "Account Updated");
|
||||||
}
|
}
|
||||||
@ -227,7 +229,7 @@ $("body").on("click", "#connectExistingAccountBtn", function () {
|
|||||||
app.dialog.alert("Please enter a full 10-digit phone number.", "Oops!");
|
app.dialog.alert("Please enter a full 10-digit phone number.", "Oops!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setStorage("phonenumber", phone);
|
setStorage("accountnumber", accountnumber);
|
||||||
router.refreshPage();
|
router.refreshPage();
|
||||||
}, function (cancel) {
|
}, function (cancel) {
|
||||||
// shrug
|
// shrug
|
||||||
@ -236,6 +238,7 @@ $("body").on("click", "#connectExistingAccountBtn", function () {
|
|||||||
|
|
||||||
$("body").on("popup:open", "#accountUpdatePopup", function () {
|
$("body").on("popup:open", "#accountUpdatePopup", function () {
|
||||||
app.input.checkEmptyState("#accountupdateform input#name");
|
app.input.checkEmptyState("#accountupdateform input#name");
|
||||||
|
app.input.checkEmptyState("#accountupdateform input#phone");
|
||||||
app.input.checkEmptyState("#accountupdateform input#email");
|
app.input.checkEmptyState("#accountupdateform input#email");
|
||||||
app.input.checkEmptyState("#accountupdateform input#streetaddress");
|
app.input.checkEmptyState("#accountupdateform input#streetaddress");
|
||||||
app.input.checkEmptyState("#accountupdateform input#zipcode");
|
app.input.checkEmptyState("#accountupdateform input#zipcode");
|
||||||
@ -269,7 +272,7 @@ function openCheckoutWindowToSaveCard(onaccountpage) {
|
|||||||
onaccountpage = true;
|
onaccountpage = true;
|
||||||
}
|
}
|
||||||
openBrowser(SETTINGS.apis.redirecttopaymentsetup
|
openBrowser(SETTINGS.apis.redirecttopaymentsetup
|
||||||
+ "?phone=" + getStorage("phonenumber")
|
+ "?accountnumber=" + getStorage("accountnumber")
|
||||||
+ "&accountkey=" + getStorage("accountkey"),
|
+ "&accountkey=" + getStorage("accountkey"),
|
||||||
"location=yes,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no,hardwareback=no,fullscreen=no,presentationstyle=pagesheet,toolbarposition=top,lefttoright=yes,toolbarcolor=#D0F2FC",
|
"location=yes,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no,hardwareback=no,fullscreen=no,presentationstyle=pagesheet,toolbarposition=top,lefttoright=yes,toolbarcolor=#D0F2FC",
|
||||||
function () {
|
function () {
|
||||||
|
@ -35,7 +35,7 @@ function captureAndSendPickupCode() {
|
|||||||
function sendPickupCode(code) {
|
function sendPickupCode(code) {
|
||||||
app.dialog.preloader("Loading...");
|
app.dialog.preloader("Loading...");
|
||||||
apirequest(SETTINGS.apis.dropandsendpickup, {
|
apirequest(SETTINGS.apis.dropandsendpickup, {
|
||||||
phone: getStorage("phonenumber"),
|
accountnumber: getStorage("accountnumber"),
|
||||||
accountkey: getStorage("accountkey"),
|
accountkey: getStorage("accountkey"),
|
||||||
locationnumber: code
|
locationnumber: code
|
||||||
}, function (resp) {
|
}, function (resp) {
|
||||||
@ -139,7 +139,7 @@ $("body").on("popup:open", "#dasLocationMapPopup", function () {
|
|||||||
|
|
||||||
$("body").on("popup:open", "#dasHowItWorksPopup", function () {
|
$("body").on("popup:open", "#dasHowItWorksPopup", function () {
|
||||||
// Put user's account number in the instructions
|
// Put user's account number in the instructions
|
||||||
if (inStorage("phonenumber") && inStorage("accountkey")) {
|
if (inStorage("accountnumber") && inStorage("accountkey")) {
|
||||||
$("#dasHowItWorksAccountNumber").text(" (yours is " + getStorage("phonenumber") + ")");
|
$("#dasHowItWorksAccountNumber").text(" (yours is " + getStorage("accountnumber") + ")");
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -165,7 +165,13 @@ function setAnimations(enabled) {
|
|||||||
applyColorTheme();
|
applyColorTheme();
|
||||||
setAnimations();
|
setAnimations();
|
||||||
|
|
||||||
var setup = (inStorage("phonenumber") && inStorage("accountkey")) || inStorage("setupskipped");
|
// Migrate from old to new account number storage key
|
||||||
|
if (inStorage("phonenumber") && !inStorage("accountnumber")) {
|
||||||
|
setStorage("accountnumber", getStorage("phonenumber"));
|
||||||
|
removeFromStorage("phonenumber");
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = (inStorage("accountnumber") && inStorage("accountkey")) || inStorage("setupskipped");
|
||||||
|
|
||||||
app.init();
|
app.init();
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ $('.item-content[data-setting=hideaccountnag] .toggle input').on("change", funct
|
|||||||
|
|
||||||
function resetAccountPrompt() {
|
function resetAccountPrompt() {
|
||||||
app.dialog.confirm("Are you sure you want to log out?", function () {
|
app.dialog.confirm("Are you sure you want to log out?", function () {
|
||||||
removeFromStorage("phonenumber");
|
removeFromStorage("accountnumber");
|
||||||
removeFromStorage("accountkey");
|
removeFromStorage("accountkey");
|
||||||
restartApplication();
|
restartApplication();
|
||||||
});
|
});
|
||||||
|
@ -143,6 +143,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="item-content item-input item-input-outline">
|
||||||
|
<div class="item-inner">
|
||||||
|
<div class="item-title item-floating-label">Phone Number</div>
|
||||||
|
<div class="item-input-wrap">
|
||||||
|
<input type="phone" id="phone" autocorrect="off" />
|
||||||
|
<span class="input-clear-button"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li class="item-content item-input item-input-outline">
|
<li class="item-content item-input item-input-outline">
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title item-floating-label">Email</div>
|
<div class="item-title item-floating-label">Email</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user