Prompt to agree to terms of service, add client-side user/pass check

master
Skylar Ittner 5 years ago
parent fe4629fcdb
commit 3cad059dbe

@ -26,7 +26,7 @@ function checkAndSave(username, password) {
localStorage.setItem("accttype", "giver"); localStorage.setItem("accttype", "giver");
} else if (profile.profile.type == 2) { } else if (profile.profile.type == 2) {
localStorage.setItem("accttype", "receiver"); localStorage.setItem("accttype", "receiver");
} else if (profile.profile.type == 3){ } else if (profile.profile.type == 3) {
app.preloader.hide(); app.preloader.hide();
app.dialog.alert("You need to download the merchant app instead. Visit ntsm.co/contact if you need help.", "Error"); app.dialog.alert("You need to download the merchant app instead. Visit ntsm.co/contact if you need help.", "Error");
return; return;
@ -61,17 +61,47 @@ function createAccount() {
var username = $("#username").val(); var username = $("#username").val();
var password = $("#password").val(); var password = $("#password").val();
app.preloader.show(); if (username.length < 1) {
app.dialog.alert("Enter a username.", "Error");
return;
}
if (password.length < SETTINGS["min_password_length"]) {
app.dialog.alert("Password must be at least " + SETTINGS["min_password_length"] + " characters long.", "Error");
return;
}
callAPI("signup", { app.dialog.create({
username: username, text: "I agree to the terms of service and privacy policy.",
password: password, buttons: [
accttype: type {
}, function (data) { text: "No",
app.preloader.hide(); onClick: function () {
checkAndSave(username, password, type); restartApplication();
}, function (msg) { }
app.preloader.hide(); },
app.dialog.alert(msg, "Error"); {
}); text: "Yes",
onClick: function () {
app.preloader.show();
callAPI("signup", {
username: username,
password: password,
accttype: type
}, function (data) {
app.preloader.hide();
checkAndSave(username, password, type);
}, function (msg) {
app.preloader.hide();
app.dialog.alert(msg, "Error");
});
}
},
{
text: "Show",
onClick: function () {
openBrowser(SETTINGS["terms_of_service_url"]);
}
},
]
}).open();
} }

@ -107,7 +107,7 @@ var routes = [
setting: "privacy", setting: "privacy",
title: "Privacy Policy", title: "Privacy Policy",
text: "", text: "",
onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=HelpingHelenaApp')" onclick: "openBrowser('" + SETTINGS["terms_of_service_url"] + "')"
}] }]
} }
}); });

@ -9,5 +9,7 @@
*/ */
var SETTINGS = { var SETTINGS = {
server: "http://localhost/helpinghelena/api", server: "http://localhost/helpinghelena/api",
webapp_url: "https://app.helpinghelena.org/" webapp_url: "https://app.helpinghelena.org/",
terms_of_service_url: "https://netsyms.com/legal?pk_campaign=HelpingHelenaApp",
min_password_length: 8
}; };
Loading…
Cancel
Save