-
Notifications
You must be signed in to change notification settings - Fork 1
/
regform.html
117 lines (105 loc) · 4.31 KB
/
regform.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
<html>
<head>
<link rel="stylesheet" href="style1.css">
</head>
<body>
<div class="wrapper">
<div class="form-left">
<h2 class="text-uppercase">information</h2>
<p>
By registering with HealthierWe you can keep track of all your health issues and book appointments for your further requirements </p>
<p class="text">
<span>Our Moto:To Digitalize everyone in the health sector by maintaining the privacy of each individual</span>
</p>
<div class="form-field">
<a href=logform.html><b>"Have an Account?"</b></a>
</div>
</div>
<div class="form-right">
<h2 class="text-uppercase">Registration form</h2>
<div class="row">
<div class="col-sm-6 mb-3">
<label>Name</label>
<input type="text" name="name" id="name" class="input-field">
</div>
<div class="col-sm-6 mb-3">
<label>phone no</label>
<input type="number" name="pno" id="pno" class="input-field">
</div>
</div>
<div class="mb-3">
<label>Your Email</label>
<input type="email" id="email" class="input-field" name="email" required>
</div>
<div class="row">
<div class="col-sm-6 mb-3">
<label>Password</label>
<input type="password" id="password" name="password" class="input-field">
</div>
<div class="col-sm-6 mb-3">
<label>Confirm Password</label>
<input type="password" name="cpwd" id="cpwd" class="input-field">
</div>
</div>
<div class="mb-3">
<label class="option">I agree to the <a href="#">Terms and Conditions</a>
<input type="checkbox" checked>
<span class="checkmark"></span>
</label>
</div>
<div class="form-field">
<button id="Register" value="Register" class="Register" name="Register">submit</button>
</div>
</div>
</div>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.8.4/firebase-app.js";
import { getAuth, createUserWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/9.8.4/firebase-auth.js";
import { getDatabase,set,ref } from "https://www.gstatic.com/firebasejs/9.8.4/firebase-database.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: "AIzaSyCcGqW996lHHYUsOMMsK-wTTvdgGKHebMI",
authDomain: "healthierwe-4d9e4.firebaseapp.com",
projectId: "healthierwe-4d9e4",
storageBucket: "healthierwe-4d9e4.appspot.com",
messagingSenderId: "483118630289",
appId: "1:483118630289:web:59140dc8abe27328374630"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const database = getDatabase(app);
Register.addEventListener('click',(e) =>{
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
set(ref(database, 'users/' + user.uid), {
email: email,
password: password
})
.then(() => {
// Data saved successfully!
alert('Registered Successfully');
})
.catch((error) => {
// The write failed...
alert(error);
});
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert(errorMessage);
// ..
});
});
</script>
</body>
</html>