diff --git a/src/index.html b/src/index.html index f9f6c311..334fa3f1 100644 --- a/src/index.html +++ b/src/index.html @@ -10,55 +10,29 @@
-

DoogoS

+

DoggoS

Bienvenido(a)

REGISTRATE

-
+ - - +
+
+ +
+ +
- - - - - - - -

primer Comentario Roxsy

- + \ No newline at end of file diff --git a/src/lib/style.css b/src/lib/style.css new file mode 100644 index 00000000..97177063 --- /dev/null +++ b/src/lib/style.css @@ -0,0 +1,13 @@ +/* poppins */ +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500&display=swap'); +* { + margin : 0; + padding: 0; + box-sizing: border-box; +} + +body{ + /* extraligth 200 */ + font-family: 'Poppins', sans-serif;; +} + diff --git a/src/main.js b/src/main.js index 5ff478d9..032f9104 100644 --- a/src/main.js +++ b/src/main.js @@ -3,18 +3,81 @@ import { myFunction } from './lib/index.js'; -myFunction(); -console.log("esto es main"); +// Import the functions you need from the SDKs you need +import { initializeApp } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js"; +import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-analytics.js"; +// TODO: Add SDKs for Firebase products that you want to use +// https://firebase.google.com/docs/web/setup#available-libraries +// Autentificacion +import {getAuth} from "https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js" +import {createUserWithEmailAndPassword} from "https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js" + +// Your web app's Firebase configuration +// For Firebase JS SDK v7.20.0 and later, measurementId is optional +// Firebase, esta informacion la utiliza firebase para el uso de su servicio +const firebaseConfig = { + apiKey: "AIzaSyAQxr8QueNyoazFnT3cCFo4YeCEz7S4FaE", + authDomain: "social-network-dog.firebaseapp.com", + projectId: "social-network-dog", + storageBucket: "social-network-dog.appspot.com", + messagingSenderId: "1073529346267", + appId: "1:1073529346267:web:b2b1e7b435a9c16adc14fe", + measurementId: "G-5PBN6ZD4GQ" +}; + + + +// Initialize Firebase +const app = initializeApp(firebaseConfig); +const analytics = getAnalytics(app); +// Initialize Firebase Authentication and get a reference to the service +const auth = getAuth(app) + + + + +// myFunction(); +// console.log("esto es main"); const nameRegister = document.querySelector("#nameRegister"); const emailRegister = document.querySelector("#emailRegister"); const passwordRegister = document.querySelector("#passwordRegister"); const passwordConfirm = document.querySelector("#passwordConfirm"); -const register = document.querySelector("#register"); +const buttonRegister = document.querySelector("#register"); +const formRegister = document.querySelector("#formRegister"); +const messageEmail = document.querySelector("#messageEmail"); +const messagePassword = document.querySelector("#messagePassword"); +const anotherMessageEmail = document.querySelector("#anotherMessageEmail"); +const messagePasswordConfirm = document.querySelector("#messagePasswordConfirm"); -register.addEventListener('click', (e) => { +formRegister.addEventListener('submit', (e) => { e.preventDefault(); - console.log(nameRegister.value , emailRegister.value); -}) + console.log(nameRegister.value, emailRegister.value); + +const authFirebase = createUserWithEmailAndPassword(auth, emailRegister.value, passwordRegister.value) + .then((authFirebase) => { + // const user = authFirebase.user + console.log(authFirebase) + }) + .catch((error) => { + console.log(error.message) + // identificardor unico para el error + console.log(error.code) + + if(error.code === "auth/invalid-email"){ + messageEmail.innerHTML = "correo invalido" + } else if (error.code === "auth/email-already-in-use"){ + messageEmail.innerHTML = "el correo ya fue utilizado" + } else if (error.code === "auth/weak-password"){ + messagePassword.innerHTML = "la contrasena debe tener por lo menos 6 caracteres" + } + }) + }); + buttonRegister.addEventListener("click", ()=> { + if( passwordConfirm.value != passwordRegister.value){ + messagePasswordConfirm.innerHTML = "la contrasena no es igual" + } + }); + \ No newline at end of file