From 1ad5b402ef4d984095e511acd41a9f48e5c85e8a Mon Sep 17 00:00:00 2001 From: Ian De La Cruz Date: Sun, 28 Feb 2016 07:07:42 +0800 Subject: [PATCH] Signup works --- index.html | 13 +++++++------ js/main.js | 24 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index fc03971..494ecf2 100644 --- a/index.html +++ b/index.html @@ -45,18 +45,18 @@

Know when to start your tasks.

Sign Up

- - + + - +

Log In

- - - + + +
@@ -75,6 +75,7 @@

Log In

+ diff --git a/js/main.js b/js/main.js index 46187bb..ccdcecc 100644 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,7 @@ +Parse.initialize('M7rEpExhQwGyQFhORep60981O9FF83c66vj8SQ1L','LVdjgbIgxWhoqazEsjDTRMTWGKxPPBRzsjuDYKKe'); + // from http://codepen.io/diegoleme/pen/surIK -var password = document.getElementById("password") - , confirm_password = document.getElementById("confirm_password"); +var password = document.getElementById("password"), confirm_password = document.getElementById("confirm_password"); function validatePassword(){ if(password.value != confirm_password.value) { @@ -26,4 +27,21 @@ $(function() { } } }); -}); \ No newline at end of file +}); + +var signUp = document.getElementById('signUp'); +signUp.addEventListener('click', function(){ + var user = new Parse.User(); + user.set("username", document.getElementById('fullname').value); + user.set("password", document.getElementById('password').value); + user.set("email", document.getElementById('email').value); + user.signUp(null, { + success: function(user) { + location.href="dashboard.html"; + }, + error: function(user, error) { + // Show the error message somewhere and let the user try again. + alert("Error: " + error.code + " " + error.message); + } + }); +});