Prompt to agree to terms of service, add client-side user/pass check
This commit is contained in:
parent
fe4629fcdb
commit
3cad059dbe
@ -26,7 +26,7 @@ function checkAndSave(username, password) {
|
||||
localStorage.setItem("accttype", "giver");
|
||||
} else if (profile.profile.type == 2) {
|
||||
localStorage.setItem("accttype", "receiver");
|
||||
} else if (profile.profile.type == 3){
|
||||
} 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;
|
||||
@ -61,17 +61,47 @@ function createAccount() {
|
||||
var username = $("#username").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", {
|
||||
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");
|
||||
});
|
||||
app.dialog.create({
|
||||
text: "I agree to the terms of service and privacy policy.",
|
||||
buttons: [
|
||||
{
|
||||
text: "No",
|
||||
onClick: function () {
|
||||
restartApplication();
|
||||
}
|
||||
},
|
||||
{
|
||||
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",
|
||||
title: "Privacy Policy",
|
||||
text: "",
|
||||
onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=HelpingHelenaApp')"
|
||||
onclick: "openBrowser('" + SETTINGS["terms_of_service_url"] + "')"
|
||||
}]
|
||||
}
|
||||
});
|
||||
|
@ -9,5 +9,7 @@
|
||||
*/
|
||||
var SETTINGS = {
|
||||
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…
x
Reference in New Issue
Block a user