-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.html
99 lines (82 loc) · 4.24 KB
/
register.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>NetBug Register</title>
<!-- Bootstrap Core CSS -->
<link href="./assets/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="./assets/css/startmin.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="./assets/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<div id="login-form-container" class="row">
<div class="col-md-4 col-md-offset-4">
<div class="login-panel panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Please Register</h3>
</div>
<div class="panel-body">
<form id="register-form" role="form">
<fieldset>
<div class="form-group">
<input id="email" class="form-control" placeholder="E-mail" name="email" type="email" autofocus required />
</div>
<div class="form-group">
<input id="username" class="form-control" placeholder="Username" name="username" type="text" autofocus required />
</div>
<div class="form-group">
<input id="password" class="form-control" placeholder="Password" name="password" type="password" value="" required />
</div>
<div class="form-group">
<button id="register-link" class="btn btn-lg btn-success btn-block" type="submit">Register</button>
</div>
</fieldset>
</form>
<a href="login.html"><button id="register-link" class="btn btn-lg btn-primary btn-block">Login</button></a>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery -->
<script src="./assets/js/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="./assets/js/bootstrap.min.js"></script>
<!-- Toastr JS -->
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script src="./assets/js/utils.js"></script>
<!--<script src="./assets/js//controllers/login.js"></script>-->
<script type="text/javascript">
$("#register-form").on("submit", function(e){
e.preventDefault();
doRegister();
});
function doRegister(){
var register_info = {
'email' : $('#email').val(),
'username' : $('#username').val(),
'password' : $('#password').val(),
'added_at' : Math.floor(Date.now() / 1000)
}
$("register-link").prop('disabled', true);
$.post("api/register", register_info).done(function(data){
console.log(data);
//window.localStorage.setItem("token", data.token);
window.location = "login.html";
toastr.error('Succesfully registered to NetBug!');
}).fail(function(error){
$("register-link").prop('disabled', false);
toastr.error('Registration failed please try again!');
});
}
</script>
</body>
</html>