-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.html
More file actions
94 lines (82 loc) · 2.93 KB
/
signup.html
File metadata and controls
94 lines (82 loc) · 2.93 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
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MovieZone-video streaming</title>
<link rel="stylesheet" href="loginstyle.css">
</head>
<body>
<div class="wrapper">
<form action="#">
<h3>Welcome to <span style="color:#cebd40;font-weight:bold">BIT HACKERS</span></h3>
<h3>Register if you are new</h3>
<div class="input-field">
<input type="text" id="Name" required>
<label>Enter your Name</label>
</div>
<div class="input-field">
<input type="text" id="Email" required>
<label>Enter your Email</label>
</div>
<div class="input-field">
<input type="password" id="Password" required>
<label>Create New password</label>
</div>
<div class="input-field">
<input type="password" id="Password" required>
<label>Confirm New password</label>
</div>
<div class="loginpage">
<a href="login.html">Login page ?</a>
</div>
<button type="submit" id="submitData">Sign up</button>
</form>
</div>
</body>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.2.0/firebase-app.js";
import { getDatabase, set, ref } from "https://www.gstatic.com/firebasejs/10.2.0/firebase-database.js";
import { getAuth, createUserWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/10.2.0/firebase-auth.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyAy-nkdnKqWCAGhaLLzJitQlJxyXmZDNQU",
authDomain: "video-streaming-8ca82.firebaseapp.com",
databaseURL: "https://video-streaming-8ca82-default-rtdb.firebaseio.com",
projectId: "video-streaming-8ca82",
storageBucket: "video-streaming-8ca82.appspot.com",
messagingSenderId: "278174396400",
appId: "1:278174396400:web:123538f85fb5f2eb08b735"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const database = getDatabase(app);
const auth = getAuth();
submitData.addEventListener('click',(e) => {
var email = document.getElementById('Email').value;
var password = document.getElementById('Password').value;
var username = document.getElementById('Name').value;
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
set(ref(database, 'users/' + user.uid),{
username:username,
email: email
})
alert('user created!');
window.location.href = 'login.html';
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert(errorMessage);
// ..
});
});
</script>
</html>