-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathauth.html
346 lines (278 loc) · 12.8 KB
/
auth.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
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google Sign in for web-->
<meta name="google-signin-client_id" content="509844838878-o3s62om2quqio2cei8d9s5k2l5t3k5up.apps.googleusercontent.com" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<style>
/* sign in FORM */
#logreg-forms {
width: 412px;
margin: 10vh auto;
background-color: #f3f3f3;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: all 0.3s cubic-bezier(.25, .8, .25, 1);
}
#logreg-forms form {
width: 100%;
max-width: 410px;
padding: 15px;
margin: auto;
}
#logreg-forms .form-control {
position: relative;
box-sizing: border-box;
height: auto;
padding: 10px;
font-size: 16px;
}
#logreg-forms .form-control:focus {
z-index: 2;
}
#logreg-forms .form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
#logreg-forms .form-signin input[type="password"] {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
#logreg-forms .social-login {
width: 390px;
margin: 0 auto;
margin-bottom: 14px;
}
#logreg-forms .social-btn {
font-weight: 100;
color: white;
width: 190px;
font-size: 0.9rem;
}
#logreg-forms a {
display: block;
padding-top: 10px;
color: lightseagreen;
}
#logreg-form .lines {
width: 200px;
border: 1px solid red;
}
#logreg-forms button[type="submit"] {
margin-top: 10px;
}
#logreg-forms .facebook-btn {
background-color: #3C589C;
}
#logreg-forms .google-btn {
background-color: #DF4B3B;
}
#logreg-forms .form-reset,
#logreg-forms .form-signup {
display: none;
}
#logreg-forms .form-signup .social-btn {
width: 210px;
}
#logreg-forms .form-signup input {
margin-bottom: 2px;
}
.form-signup .social-login {
width: 210px !important;
margin: 0 auto;
}
/* Mobile */
@media screen and (max-width:500px) {
#logreg-forms {
width: 300px;
}
#logreg-forms .social-login {
width: 200px;
margin: 0 auto;
margin-bottom: 10px;
}
#logreg-forms .social-btn {
font-size: 1.3rem;
font-weight: 100;
color: white;
width: 200px;
height: 56px;
}
#logreg-forms .social-btn:nth-child(1) {
margin-bottom: 5px;
}
#logreg-forms .social-btn span {
display: none;
}
#logreg-forms .facebook-btn:after {
content: 'Facebook';
}
#logreg-forms .google-btn:after {
content: 'Google+';
}
}
</style>
<title>Complete Register Form with backend</title>
</head>
<body>
<div id="logreg-forms">
<form class="form-signin" accept="#">
<h1 class="h3 mb-3 font-weight-normal" style="text-align: center"> Sign in</h1>
<div class="social-login">
<button class="btn google-btn social-btn" type="button" id="googleLogin"><span><i
class="fab fa-google-plus-g"></i> Sign in with Google+</span> </button>
</div>
<p style="text-align:center"> OR </p>
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" required="" autofocus="">
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required="">
<button class="btn btn-success btn-block" id="loginbtn" type="button"><i class="fas fa-sign-in-alt"></i>
Sign in</button>
<!--
<p style="text-align:center"> OR </p>
<input type="text" id="inputPhone" class="form-control" placeholder="PHONE" required="" autofocus="">
<div id="recaptcha-container"></div>
<button class="btn btn-success btn-block" type="button" id="phoneloginbtn"><i
class="fas fa-sign-in-alt"></i> SEND OTP</button>
<input type="otp" id="inputOtp" class="form-control" placeholder="OTP" required="">
<button class="btn btn-success btn-block" type="button" id="verifyotp"><i class="fas fa-sign-in-alt"></i>
VERIFY OTP</button> -->
<hr>
<!-- <p>Don't have an account!</p> -->
<button class="btn btn-primary btn-block" type="button" id="btn-signup"><i class="fas fa-user-plus"></i>
Sign up New Account</button>
</form>
<form action="/reset/password/" class="form-reset">
<input type="email" id="resetEmail" class="form-control" placeholder="Email address" required="" autofocus="">
<button class="btn btn-primary btn-block" type="submit">Reset Password</button>
<a href="#" id="cancel_reset"><i class="fas fa-angle-left"></i> Back</a>
</form>
<form action="#" class="form-signup">
<div class="social-login">
<button class="btn google-btn social-btn" type="button"><span><i class="fab fa-google-plus-g"></i> Sign
in with Google+</span> </button>
</div>
<p style="text-align:center">OR</p>
<input type="email" id="useremail" class="form-control" placeholder="Email address" required autofocus="">
<input type="password" id="userpass" class="form-control" placeholder="Password" required autofocus="">
<button class="btn btn-primary btn-block" type="button" id="signupbtn"><i class="fas fa-user-plus"></i> Sign
Up</button>
<a href="#" id="cancel_signup"><i class="fas fa-angle-left"></i> Back</a>
</form>
<br>
</div>
<script>
function toggleResetPswd(e) {
e.preventDefault();
$('#logreg-forms .form-signin').toggle() // display:block or none
$('#logreg-forms .form-reset').toggle() // display:block or none
}
function toggleSignUp(e) {
e.preventDefault();
$('#logreg-forms .form-signin').toggle(); // display:block or none
$('#logreg-forms .form-signup').toggle(); // display:block or none
}
$(() => {
// Login Register Form
$('#logreg-forms #forgot_pswd').click(toggleResetPswd);
$('#logreg-forms #cancel_reset').click(toggleResetPswd);
$('#logreg-forms #btn-signup').click(toggleSignUp);
$('#logreg-forms #cancel_signup').click(toggleSignUp);
});
</script>
</p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.19.0/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/7.19.0/firebase-analytics.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/7.19.0/firebase-auth.js"></script>
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyBVx0OGh7UsueniMy2B298Cv5owJYtHaG4",
authDomain: "registration-e6b4c.firebaseapp.com",
projectId: "registration-e6b4c",
storageBucket: "registration-e6b4c.appspot.com",
messagingSenderId: "509844838878",
appId: "1:509844838878:web:81c3393c1d1c064fcc254f",
measurementId: "G-2B9NTLZD1R"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
var signupbtn = document.getElementById("signupbtn")
var emailsignup = document.getElementById("useremail")
var passswordsignup = document.getElementById("userpass")
//================Signup With Email and Password==========================
signupbtn.onclick = function() {
signupbtn.disabled = true;
signupbtn.textContent = "Registering Your Account! Please Wait";
firebase.auth().createUserWithEmailAndPassword(emailsignup.value, passswordsignup.value).then(function(response) {
sendingVerifyEmail(signupbtn);
console.log(response);
})
.catch(function(error) {
signupbtn.disabled = false;
signupbtn.textContent = "Sign Up";
console.log(error);
})
}
function sendingVerifyEmail(button) {
firebase.auth().currentUser.sendEmailVerification().then(function(response) {
signupbtn.disabled = false;
signupbtn.textContent = "Sign Up";
console.log(response);
})
.catch(function(error) {
signupbtn.disabled = false;
signupbtn.textContent = "Sign Up S";
console.log(error);
})
}
//================End Signup With Email and Password======================
//==========================Sign in With Email and Password============================
var loginemail = document.getElementById("inputEmail");
var loginpassword = document.getElementById("inputPassword");
var loginbtn = document.getElementById("loginbtn");
loginbtn.onclick = function() {
loginbtn.disabled = true;
loginbtn.textContent = "Logging In Please Wait.."
firebase.auth().signInWithEmailAndPassword(loginemail.value, loginpassword.value).then(function(response) {
console.log(response);
loginbtn.disabled = false;
loginbtn.textContent = "Sign In"
window.location.href = "home2.html";
})
.catch(function(error) {
console.log(error);
loginbtn.disabled = false;
loginbtn.textContent = "Sign In"
alert('you typed wrong password , try again !');
})
}
//======================Sign With Email and Password
///=================Login With google===========================
var googleLogin = document.getElementById("googleLogin");
googleLogin.onclick = function() {
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('https://www.googleapis.com/auth/contacts.readonly');
firebase.auth().signInWithPopup().then(function(response) {
console.log(response);
}).catch(function(erros) {
console.log(error)
})
}
//=======================End Login With Google==================
</script>
</body>
</html>