Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 9 additions & 35 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,29 @@

<body>
<header>
<h1>DoogoS</h1>
<h1>DoggoS</h1>
<p>Bienvenido(a)</p>
</header>
<main>
<!-- Seccion Registrarse -->
<h2>REGISTRATE</h2>
<form action="">
<form action="" id="formRegister">
<input type="text" id="nameRegister" placeholder="Nombres y Apellidos">
<input type="text" id="emailRegister" placeholder="Correo">
<input type="password" id="passwordRegister" placeholder="contrasena" >
<input type="password" id="passwordConfirm" placeholder="Digite nuevamente su contrasena" >
<div id="messageEmail"></div>
<div id="anotherMessageEmail"></div>
<input type="password" id="passwordRegister" placeholder="contrasena">
<div id="messagePassword"></div>
<input type="password" id="passwordConfirm" placeholder="Digite nuevamente su contrasena">
<div id="messagePasswordConfirm"></div>
<button type="submit" id="register">REGISTRARSE</button>
</form>
</main>





<!-- Firebase -->
<script type="module">
// 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

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
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);
</script>



<p>primer Comentario Roxsy</p>
<script type="module" src="main.js"></script>
<footer> Proyecto Social Media </footer>

</body>

</html>
13 changes: 13 additions & 0 deletions src/lib/style.css
Original file line number Diff line number Diff line change
@@ -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;;
}

75 changes: 69 additions & 6 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
});