-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsignup.js
42 lines (38 loc) · 1.48 KB
/
signup.js
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
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.4.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/10.4.0/firebase-analytics.js";
import { getAuth, createUserWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/10.4.0/firebase-auth.js";
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyC8FMugbQLpl89f0qFMb_Ge3-xstO1QCxQ",
authDomain: "chatbot-auth-7d520.firebaseapp.com",
projectId: "chatbot-auth-7d520",
storageBucket: "chatbot-auth-7d520.appspot.com",
messagingSenderId: "183806305634",
appId: "1:183806305634:web:0eab4e0921ac1b4466b83b"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics=getAnalytics(app);
const auth = getAuth(app);
let name=document.getElementById("name");
let mail=document.getElementById("mail");
let phone=document.getElementById("phone");
let pass=document.getElementById("pass");
window.signup= function(e){
e.preventDefault();
let obj={
name:name.value,
mail:mail.value,
phone:phone.value,
pass:pass.value,
}
createUserWithEmailAndPassword(auth, obj.mail, obj.pass)
.then(function(success){
window.location.replace("chat.html");
})
.catch(function(err){
alert("Something went wrong! Please, Check your Network Connectivity!");
})
};