Link registration

This commit is contained in:
James Wang 2015-12-23 23:03:55 -05:00
parent e92a343590
commit 41f5e34aa6
2 changed files with 56 additions and 31 deletions

19
web/js/register.js Normal file
View file

@ -0,0 +1,19 @@
$("#registration-form").on("submit", function(e) {
e.preventDefault();
register($("#name").val(), $("#username").val(), $("#password").val(), $("#password_confirm").val(), $("#email").val());
});
function register(name, username, password, password_confirm, email) {
$.post("/api/user/register", {
name: name,
username: username,
password: password,
password_confirm: password_confirm,
email: email
}, function(data) {
$("#status").text(data.message);
if (data.success == 1) {
// wait then redirect or whatever
}
});
}

View file

@ -2,6 +2,7 @@
<html> <html>
<head> <head>
<title>Register</title> <title>Register</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/semantic.min.js"></script> <script src="js/semantic.min.js"></script>
<link type="text/css" rel="stylesheet" href="css/semantic.min.css"> <link type="text/css" rel="stylesheet" href="css/semantic.min.css">
<script src='https://www.google.com/recaptcha/api.js'></script> <script src='https://www.google.com/recaptcha/api.js'></script>
@ -20,42 +21,47 @@
<h1 style="color: #69D2E7; font-size: 75px;">Register Yourself</h1> <h1 style="color: #69D2E7; font-size: 75px;">Register Yourself</h1>
<hr style="margin-left: 10em; margin-right: 10em;"> <hr style="margin-left: 10em; margin-right: 10em;">
<br> <br>
<div class="ui input"> <form id="registration-form" action="return false;">
<input type="text" placeholder="Name" id="name" style="width:50em;"> <div class="ui input">
</div> <input id="name" type="text" placeholder="Name" id="name" style="width:50em;">
<br><br> </div>
<select name="gender" class="ui dropdown" id="select" style="width: 50em;"> <br><br>
<option value="1">US Middle/High School Student</option> <select name="gender" class="ui dropdown" id="select" style="width: 50em;">
<option value="2">US Middle/High School Teacher</option> <option value="1">US Middle/High School Student</option>
<option value="3">Non-US/Non-Student/Observer</option> <option value="2">US Middle/High School Teacher</option>
</select> <option value="3">Non-US/Non-Student/Observer</option>
<br><br> </select>
<div class="ui input"> <br><br>
<input type="text" placeholder="Username" style="width:50em;"> <div class="ui input">
</div> <input id="username" type="text" placeholder="Username" style="width:50em;">
<br><br> </div>
<div class="ui input"> <br><br>
<input type="email" placeholder="Email" style="width:50em;"> <div class="ui input">
</div> <input id="email" type="email" placeholder="Email" style="width:50em;">
<br><br> </div>
<div class="ui input"> <br><br>
<input type="password" placeholder="Password" style="width:50em;"> <div class="ui input">
</div> <input id="password" type="password" placeholder="Password" style="width:50em;">
<br><br> </div>
<div class="ui input"> <br><br>
<input type="password" placeholder="Confirm Password" style="width:50em;"> <div class="ui input">
</div> <input id="password_confirm" type="password" placeholder="Confirm Password" style="width:50em;">
<br><br> </div>
<div class="g-recaptcha" data-sitekey="6Lc4xhMTAAAAAIaiF3yEWGbHRaGgMg4FHor61p1G"></div> <br><br>
<br><br> <div class="g-recaptcha" data-sitekey="6Lc4xhMTAAAAAIaiF3yEWGbHRaGgMg4FHor61p1G"></div>
<button class="ui primary button" style="width:25em"> <br><br>
Submit <button class="ui primary button" style="width:25em">
</button> Submit
</button>
</form>
</center> </center>
<div id="status">
</div>
</body> </body>
<script> <script>
$('#select') $('#select')
.dropdown() .dropdown()
; ;
</script> </script>
<script src="js/register.js"></script>
<html> <html>