-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.html
94 lines (77 loc) · 2.75 KB
/
signup.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
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="postQuestion.css">
<link rel="stylesheet" type="text/css" href="splash.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<title>Signup</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<body background="background.jpg" >
<main>
<header class="app_header" ></header>
<center>
<img src="logo.png" class="logo" style="margin-top: 5%; margin-bottom: 0.2%"></img>
<div style="margin-top: 6%"></div>
<div>
<div>
<input id="first_name" class="infobar" placeholder="First Name"></input>
<input id="last_name" class="infobar" placeholder="Last Name"></input>
</div>
<div>
<input id="email" class="infobar" placeholder="Email"></input>
<input id="username" class="infobar" placeholder="Username"></input>
</div>
<div>
<input id="password" class="infobar" placeholder="Password" type="password"></input>
<input id="reenter_password" class="infobar" placeholder="Reenter password" type="password"></input>
</div>
<button id="signup" onclick="handleSignup();" class="button-intro button-hover" style="margin-top:0.9%; height: 1.5em;font-size: 2em">Sign Up</button>
</div>
<div class="footer"></div>
</body>
<script src="/socket.io/socket.io.js"></script>
<script src="/browserfs.min.js"></script>
<script type="text/javascript">
BrowserFS.install(window);
BrowserFS.configure({
fs : "LocalStorage"
}, e => {
if (e) {
throw e;
}
});
const fs = require('fs');
const socket = io();
const handleSignup = () => {
msg = {
userName : document.getElementById("username").value,
email : document.getElementById("email").value,
profileImageExists : false,
profileImageLink : "",
firstName : document.getElementById("first_name").value,
lastName : document.getElementById("last_name").value,
country : "Pak",
gender : 1,
password_hash : document.getElementById("password").value
};
socket.emit('msgUserSignupRequest', msg);
}
socket.on('msgUserSignupRequestConfirmed', msg => {
fs.writeFile('current_user.txt', msg._id, err => {
if (err) {
console.log(err);
alert('Failed to locally store user with ID' + msg._id);
} else {
window.open("http://52.170.186.150:3000/profile", "_self");
}
});
});
</script>
</html