Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //Get elements
  2. const txtEmail = document.getElementById('InputEmail1');
  3. const txtPassword = document.getElementById('InputPassword1');
  4. const btnLogin = document.getElementById('btnLogin');
  5. const btnSignUp = document.getElementById('btnSignUp');
  6. const btnLogout = document.getElementById('btnLogout');
  7. // Add login event
  8. btnLogin.addEventListener('click', e => {
  9. // Get email and pass
  10. const email = txtEmail.value;
  11. const pass = txtPassword.value;
  12. const auth = firebase.auth();
  13. // Sign in
  14. const promise = auth.signInWithEmailAndPassword(email, pass);
  15. promise.catch(e => console.log(e.message));
  16. promise.then(function (user) {
  17. // success
  18. console.log("Email: " + user.email);
  19. window.location.href = "notizenEintrag.html";
  20. })
  21. });
  22. // Add signup event
  23. btnSignUp.addEventListener('click', e => {
  24. // Get email and pass
  25. const email = txtEmail.value;
  26. const pass = txtPassword.value;
  27. const auth = firebase.auth();
  28. // Sign in
  29. const promise = auth.createUserWithEmailAndPassword(email, pass);
  30. promise.catch(e => console.log(e.message));
  31. promise.then(function (user) {
  32. // success
  33. console.log("Email: " + user.email);
  34. window.location.href = "notizenEintrag.html";
  35. })
  36. alert("SignUp gedrückt");
  37. });
  38. btnLogout.addEventListener('click', e => {
  39. firebase.auth().signOut();
  40. });