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