forked from siddharth-rishabh/GHUMO.in
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
180 lines (158 loc) · 6.33 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" ></script>
<!-- Bootstrap theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<title>Ghumo</title>
<style>
body {
background-image: url('pexels-stephan-seeber-1261728.jpg'); /* Replace 'your-background-image.jpg' with the path to your image */
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed; /* This keeps the background image fixed as you scroll */
background-position: center center;
}
</style>
</head>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Navbar header with the collapsed button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Ghumo</a>
</div>
<!-- Navbar links -->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#" id="logout" style="display: none;">Log Out</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<form name="registration_form" id="registration_form" method="post" action="#" enctype="multipart/form-data" >
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label for="email">Email</label>
<input type="text" name="email" id="email" class="form-control" placeholder="Enter your email">
</div>
<div class="form-group">
<label for="password" >Password</label>
<input type="password" name="password" id="password" class="form-control" placeholder="Enter your password">
</div>
<button type="button" id="register" name="register" class="btn btn-success">Register Now</button>
</div><!-- end col -->
</form>
<div class="col-sm-4">
</div>
<form name="login_form" id="login_form" method="post" action="#" enctype="multipart/form-data" >
<div class="col-sm-4">
<div class="form-group">
<label for="email">Email</label>
<input type="text" name="login_email" id="login_email" class="form-control" placeholder="Enter your email">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" name="login_password" id="login_password" class="form-control" placeholder="Enter your password">
</div>
<button type="button" id="login" name="login" class="btn btn-success">Login</button>
</div><!-- end col -->
</div><!-- end row -->
</form>
</div>
<br>
<center aria-atomic="true" style="color: black; size: 0cm;">Developed by team new bits</center>
</body>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.10.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.10.0/firebase-analytics.js";
import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from "https://www.gstatic.com/firebasejs/9.10.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
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyBPbGVLDCEM6SXQDwfdbDDZ3QSfTesW_aw",
authDomain: "ghumo-login.firebaseapp.com",
databaseURL: "https://ghumo-login-default-rtdb.firebaseio.com",
projectId: "ghumo-login",
storageBucket: "ghumo-login.appspot.com",
messagingSenderId: "202648750090",
appId: "1:202648750090:web:1575d21eb411ec284237f3",
measurementId: "G-ZH43PQ0PYJ"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
const auth = getAuth();
console.log(app);
//----- New Registration code start
document.getElementById("register").addEventListener("click", function() {
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
//For new registration
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
console.log(user);
alert("Registration successfully!!");
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
// ..
console.log(errorMessage);
alert(error);
});
});
//----- End
//----- Login code start
document.getElementById("login").addEventListener("click", function() {
var email = document.getElementById("login_email").value;
var password = document.getElementById("login_password").value;
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
console.log(user);
// alert(user.email+" Login successfully!!!");
window.location.href = 'homepage.html';
document.getElementById('logout').style.display = 'block';
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.log(errorMessage);
alert(errorMessage);
});
});
//----- End
//----- Logout code start
document.getElementById("logout").addEventListener("click", function() {
signOut(auth).then(() => {
// Sign-out successful.
console.log('Sign-out successful.');
alert('Sign-out successful.');
document.getElementById('logout').style.display = 'none';
}).catch((error) => {
// An error happened.
console.log('An error happened.');
});
});
//----- End
</script>
</html>