-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistration.html
356 lines (307 loc) · 10.7 KB
/
registration.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<!--<!--
//
// Copyright 2017 Malin Yamato Lääkkö -- All rights reserved.
// https://github.com/MalinYamato
//
// MIT License
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Rakuen. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/webrtc-adapter/6.0.3/adapter.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.js"></script>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> -->
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/js/bootstrap.min.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.1.0/bootbox.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js"></script>
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3.css">
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link href="css/menus.css" rel="stylesheet" type="text/css"/>
<link href="css/modal.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="css/emojionearea.min.css">
<script src="js/SVGButton.js"></script>
<script type="text/javascript"></script>
</head>
<style>
body {
background-color: #b9d4ff;
}
/* Full-width input fields */
input[type=text], input[type=password] {
width: 40%;
padding: 10px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
float: left;
}
label {
color: #3f3f3f;
padding: 12px 20px;
font-size: 20px;
float: left;
margin: 8px 0px 0px 4px;
}
/* Set a style for all buttons */
button {
background-color: #4CAF50;
color: white;
padding: 10px;
margin: 4px 0;
border: none;
cursor: pointer;
width: 100%;
border-radius: 12px;
font-size: 20px;
}
#signIn {
margin-left: 10%;
margin-right: 10%;
}
.verifyButton {
background-color: #696969; /* Green */
color: white;
margin: 8px 4px 4px 8px;
width: 16%;
float: left;
}
/* Extra styles for the cancel button */
.cancelbtn {
background-color: #f44336;
}
/* Float cancel and signup buttons and add an equal width */
.cancelbtn, .signupbtn {
float: left;
width: 50%;
}
/* Add padding to container elements */
.container {
padding: 16px;
}
/* Clear floats */
.clearfix::after {
content: "";
clear: both;
display: table;
}
/* Change styles for cancel button and signup button on extra small screens */
@media screen and (max-width: 300px) {
.cancelbtn, .signupbtn {
width: 100%;
}
}
#validNameImg, #invalidNameImg {
width: 45px;
height: 45px;
margin-bottom: 0;
margin-top: 8px;
margin-left: 5px;
}
#invalidName, #validName {
font-weight: bold;
font-size: 16px;
text-align: center;
float: left;
width: 100%;
}
.container {
padding: 4px;
}
#invalidName {
color: red;
}
#validName {
color: #4CAF50;
}
.result {
float: left;
}
.agree {
font-size: 14px;
width: 100%;
float: right;
color: #3f3f3f;
text-align: center;
}
.welcome {
margin: 10px;
color: #3f3f3f;
}
.welcome h2 {
margin-left: 0.5em;
font-size: 30px;
}
#message {
color: #3f3f3f;
width: 100%;
text-align: center;
font-size: 20px;
margin: 1%;
margin-bottom: 2%;
}
#signInIMG {
width: 4em;
height: 3em;
}
#GoToChat {
margin-left: 33%;
margin-right: 33%;
width: 33%;
}
</style>
<body>
<div class="welcome row-flow">
<div class="flex-row">
<img id="signInIMG" src="images/rakurakuen.png" img/>
<h2>Signup Rakuen </h2>
</div>
<p>
<b> Welcome as a new member of Rakuen. </b>
Choose a handlename/nic to join and </br>
please feel free to send me an mail if you have any questions or issues: </br>
Malin Yamato Lääkkö -- [email protected] </br>
Enjoy!
</p>
<div class="flex-column">
<form id="ProfileForm" action="{{.Protocol}}://{{.Host}}/Registration" style="border:1px solid #ccc">
<input hidden name="OP" value="register"/>
<div class="container">
<label><b>Nicname</b></label>
<input maxlength="12" id="NicName" type="text" placeholder="Unique name" name="NicName" required>
<div class="result">
<img id="validNameImg" src="images/yes.png" style="display:none;">
<img id="invalidNameImg" src="images/no.png" style="display:none;">
</div>
<button type="button" onclick="verifyNicName()" class="verifyButton">Verify</button>
<div id="validName" style="display:none;"><span> Congratuation! The name is OK!</span></div>
<div id="invalidName" style="display:none;"><span> Invalid name! -- The name is taken!</span></div>
<p class="agree">By creating an account you agree to our <a href="#">Terms & Privacy</a>.</p>
</div>
</form>
<div class="clearfix" id="signIn" style="display:block;">
<div class="flex-row">
<button type="button" onclick="register()" class="signupbtn">Sign Up</button>
<button type="button" class="cancelbtn" onclick="cancel()">Cancel</button>
</div>
</div>
<div id="GoToChat" class="flex-column" style="display:none;">
<div><p id="message">C</div>
<form>
<button formaction="{{.Protocol}}://{{.Host}}/MainProfile">Complete your profile!</button>
</form>
</div>
</div>
</div>
</body>
<script>
var valid = document.getElementById("validName");
var invalid = document.getElementById("invalidName");
var validImg = document.getElementById("validNameImg");
var invalidImg = document.getElementById("invalidNameImg");
//reportStatus(false);
function reportStatus(v) {
if (v) {
valid.style.display = "block";
invalid.style.display = "none";
validImg.style.display = "block";
invalidImg.style.display = "none";
} else {
valid.style.display = "none";
invalid.style.display = "block";
validImg.style.display = "none";
invalidImg.style.display = "block";
}
}
function cancel() {
$.ajax({
type: "POST",
async: false,
url: "{{.Protocol}}://{{.Host}}/RegistrationManager",
data: {"OP": "cancel", "NicName": name},
success: function (result) {
console.log("Cancel mess " + result);
}
})
window.location.href = '{{.Protocol}}://{{.Host}}';
}
function verifyNicName() {
var name = $("#NicName").val();
console.log("Name " + name);
$.ajax({
type: "POST",
async: false,
url: "{{.Protocol}}://{{.Host}}/RegistrationManager",
data: {"OP": "checkNewNicname", "NicName": name},
success: function (result) {
console.log("mess " + result);
if (result.status == "SUCCESS") {
reportStatus(true)
} else {
reportStatus(false);
}
}
})
}
var goChat = document.getElementById("GoToChat");
var singin = document.getElementById("signIn");
function register() {
var name = $("#NicName").val();
console.log("Name " + name);
$.ajax({
type: "POST",
async: false,
url: "{{.Protocol}}://{{.Host}}/RegistrationManager",
data: {"OP": "register", "NicName": name},
success: function (result) {
console.log("mess " + result);
if (result.status == "SUCCESS") {
reportStatus(true)
$("#message").text("Registration successful");
singin.style.display = "none";
goChat.style.display = "block"
} else {
reportStatus(false);
$("#message").text("Registration was denied! Try another nic!");
singin.style.display = "block";
goChat.style.display = "none"
}
}
})
}
</script>
</body>
</html>