-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathaccount.html
More file actions
85 lines (84 loc) · 3.73 KB
/
account.html
File metadata and controls
85 lines (84 loc) · 3.73 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Fission Bank Sample</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="http://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="./common.js"></script>
<style>
html, body {
margin:0; padding:0; height:100%;
}
#content {
width: 50%;
position: relative;
top: 20%;
margin: 0 auto;
padding: 20pt;
border: 1px solid rgba(0,0,0,.15);
border-radius: .25rem
}
</style>
<script type="text/javascript">
console.log(getAuthToken())
if(!getAuthToken()) {
window.location.href = "./operation.html";
}
</script>
</head>
<body>
<div id="content" class="container">
<h2>Create user account</h2>
<div class="alert alert-success" role="alert" id="alert-success" style="display: none"></div>
<div class="alert alert-danger" role="alert" id="alert-danger" style="display: none"></div>
<form id="account-form">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Username</span>
</div>
<input type="text" name="username" id="username" class="form-control" aria-label="User account name">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Password</span>
</div>
<input type="password" name="password" id="password" class="form-control" aria-label="User account password">
</div>
<button type="button" id="form-submit" class="btn btn-primary">Create Account</button>
<button type="button" id="login-button" class="btn btn-link" >Already have accounts?</button>
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#form-submit").click(function(){
$('.alert').html('').hide();
var data = getFormData($('#account-form'));
$.ajax({
origin: "*",
type: 'POST',
url: '/accounts', // RESTful API function path
crossDomain: true,
data: JSON.stringify(data),
contentType: "application/json",
error: function (xhr) {
$('#alert-danger').html('('+xhr.status+') '+xhr.responseText).show();
return false;
},
success: function (response) {
$('#alert-success').html(response).show();
window.location.href = "./login.html";
return true;
}
});
});
$("#login-button").click(function(){
window.location.href = "./login.html";
});
});
</script>
</div>
</body>
</html>