Skip to content

Commit

Permalink
Signup works
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian De La Cruz authored and Ian De La Cruz committed Feb 27, 2016
1 parent 2eeb51e commit 1ad5b40
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
13 changes: 7 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ <h2>Know when to start your tasks.</h2>
<div id="login_signup">
<div id="signup">
<h1>Sign Up</h1>
<input type="text" name="full name" placeholder="full name" required>
<input type="email" name="email" placeholder="email address" required>
<input type="text" id="fullname" name="full name" placeholder="full name" required>
<input type="email" id="email" name="email" placeholder="email address" required>
<input type="password" name="password" id="password" placeholder="password" required>
<input type="password" name="retype" id="confirm_password" placeholder="re-type password" required>
<input class="button" type="submit" value="Start Working">
<input class="button" type="submit" value="Start Working" id="signUp" >
</div>
<div class="vertical_line"></div>
<div id="login">
<h1>Log In</h1>
<input type="email" name="email" placeholder="email address" required>
<input type="password" name="password" placeholder="password" required>
<input class="button" type="submit" value="Resume Work">
<input type="email" name="email" placeholder="email address" required id="emailLog">
<input type="password" name="password" placeholder="password" required id=passLog"">
<input class="button" type="submit" id="login" value="Resume Work">
</div>
</div>

Expand All @@ -75,6 +75,7 @@ <h1>Log In</h1>
</footer>
</main>
<script src="js/jquery-2.1.4.js"></script>
<script src="http://www.parsecdn.com/js/parse-latest.js" charset="utf-8"></script>
<script src="js/main.js"></script>
</body>
</html>
24 changes: 21 additions & 3 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -26,4 +27,21 @@ $(function() {
}
}
});
});
});

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);
}
});
});

0 comments on commit 1ad5b40

Please sign in to comment.