diff --git a/www/js/setup1.js b/www/js/setup1.js
index 1808673..7287579 100644
--- a/www/js/setup1.js
+++ b/www/js/setup1.js
@@ -8,7 +8,7 @@ $('#username').on("keyup", function () {
$('#username').val($('#username').val().toLowerCase());
});
-function checkAndSave(username, password) {
+function checkAndSave(username, password, type) {
app.preloader.show();
@@ -21,13 +21,15 @@ function checkAndSave(username, password) {
method: "POST",
data: {
username: username,
- password: password
+ password: password,
+ type: type
},
success: function (data) {
app.preloader.hide();
if (data.status == "OK") {
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();
@@ -45,9 +47,43 @@ function checkAndSave(username, password) {
function setupAccount() {
var type = $("#accttype").val();
+ var username = $("#username").val();
+ var password = $("#password").val();
+
+ checkAndSave(username, password, type);
+}
+function createAccount() {
+ var type = $("#accttype").val();
var username = $("#username").val();
var password = $("#password").val();
- checkAndSave(username, password);
+ app.preloader.show();
+
+ var url = SETTINGS["server"] + "/signup";
+
+ $.ajax({
+ url: url,
+ dataType: "json",
+ cache: false,
+ method: "POST",
+ data: {
+ username: username,
+ password: password,
+ accttype: type
+ },
+ success: function (data) {
+ app.preloader.hide();
+ if (data.status == "OK") {
+ checkAndSave(username, password, type);
+ } else if (data.status == "ERROR") {
+ app.dialog.alert(data.msg, "Error");
+ } else {
+ app.dialog.alert("", "Error");
+ }
+ }, error: function () {
+ app.preloader.hide();
+ app.dialog.alert("Could not create account. Check your connection.", "Error");
+ }
+ });
}
\ No newline at end of file
diff --git a/www/pages/home.html b/www/pages/home.html
index ec0584e..a282673 100644
--- a/www/pages/home.html
+++ b/www/pages/home.html
@@ -18,7 +18,7 @@
-
+
diff --git a/www/pages/setup0.html b/www/pages/setup0.html
index ae2c2da..48b31aa 100644
--- a/www/pages/setup0.html
+++ b/www/pages/setup0.html
@@ -18,26 +18,42 @@
-
-
Select an option to get started.
-
-
-
-
+
+
-
+
Choose an account type.
+
If you don't have an account, you can create one in the next step.
-
-
+
+
diff --git a/www/pages/setup1.html b/www/pages/setup1.html
index 3620015..5187251 100644
--- a/www/pages/setup1.html
+++ b/www/pages/setup1.html
@@ -16,41 +16,49 @@
-
+
-
-
-
Enter your account information to log in.
+
+
+
+
-
-
- -
-
-
Username
-
+
+
+
+
+ Sign In
+
+
+
+ Create Account
+
-
-
- Continue
diff --git a/www/routes.js b/www/routes.js
index 6bc3dff..090eb53 100644
--- a/www/routes.js
+++ b/www/routes.js
@@ -21,7 +21,7 @@ var routes = [
name: 'setup0'
},
{
- path: '/setup/1',
+ path: '/setup/1/:acctType',
templateUrl: './pages/setup1.html',
name: 'setup1'
},