Skip to main content

formulário de login com problema [closed]

Estou desenvolvendo um formulário de login, e esta dando um erro no último passo..

Uncaught ReferenceError: form is not defined
at login (index.js:9:8)
at HTMLButtonElement.onclick (login.html:272:79)
login @ index.js:9
onclick @ login.html:272

function validateFields(){
    toggleButtonsDisable();
    toggleEmailErrors();
   }

   function login() {
     firebase.auth().signInWithEmailAndPassword(
       form.email().value, form.password().value
     ).then(response => {
       window.location.href = "/index.html";
     }).catch(error => {
       console.log('error', error)
     });

  

   }

  function isEmailValid() {
    const email = document.getElementById("email").value;
    if (!email) {
      return false;
    }
    return validateEmail(email);

  }

  function toggleEmailErrors() {
    const email = document.getElementById('email').value;
    if (!email) {
      document.getElementById('email-required-error').style.display = "block";
    } else {
      document.getElementById('email-required-error').style.display = "none";
    }

  }

  function toggleButtonsDisable() {

      const emailValid = isEmailValid();
      document.getElementById('recover-password-button').disabled = !emailValid;

      const password = isPasswordValid();
      document.getElementById('login-button').disabled = !emailValid || !passwordValid;

  }

  function isPasswordValid() {
    const password = document.getElementById('password').value;
    if (!password) {
      return false;
    }
    return true;
  }

  function validateEmail(email) {
    return /\S+@\S+\.\S+/.test(email);
  }
</head>

  <body>

    <img class="banner" src="../img/quem-somos.png" alt="">

    <header class="header">
      <button class="header__btnMenu" style="display: none;"><i class="fa-solid fa-align-justify fa-2x"></i> <span class="sr-only">Menu</button>
      <nav class="header__nav">
        <ul>
          <li><a href="../index.html">Início</a></li>
          <li><a href="../secundarias/Quem-somos.html">Quem Somos</a></li>
          <li><a href="../secundarias/Curso.html">Curso</a></li>
          <li><a href="../secundarias/Convalidação-de-diploma.html">Convalidação de Diploma</a></li>
          <li><a href="../secundarias/Psicoterapeutas-trinicos-credenciados.html">Psicoterapeutas Trínicos Credenciados</a></li>
          <li><a href="../secundarias/Terapia-online.html">Terapia Online</a></li>
          <li><a href="../secundarias/Livros-ebooks.html">Livros/E-books</a></li>
          <li><a href="../secundarias/Contatos.html">Contatos</a></li>
        </ul>
      </nav>
    </header>

    <div id="login-container">
      <h1 class="h1">Login</h1>
      <form>
        <label for="email">E-mail</label>
        <input type="email" name="email" placeholder="Digite seu email" autocomplete="off"/>
        <div class="error">Email Inválido</div>
        <div class="error" id="email-required-error">Email Obrigatório</div>
        <label for="password">Senha</label>
        <input type="password" name="password" placeholder="Digite sua senha"/>
        <div class="error">Senha Inválida</div>
        <div class="error">Senha Obrigatória</div>
        <button type="button" class="btn" id="login-button" onclick="login()">Entrar</button>
      </form>





    </div>

  </body>

    <script src="../js/menu.js"></script>
    <script src="../js/main.js"></script>
    <script src="../js/index.js"></script>
    <script src="https://www.gstatic.com/firebasejs/9.9.4/firebase-app-compat.js"></script>
    <script src="https://www.gstatic.com/firebasejs/9.9.4/firebase-auth-compat.js"></script>
    <script>
    const firebaseConfig = {
          apiKey: "AIzaSyAfVQmZHjackadr36QeUuXGoDCE12rRthY",
          authDomain: "login-7ba66.firebaseapp.com",
          projectId: "login-7ba66",
          storageBucket: "login-7ba66.appspot.com",
          messagingSenderId: "60367460532",
          appId: "1:60367460532:web:75192848133ccca5141fe1"
        };
        firebase.initializeApp(firebaseConfig);

        console.log('antes');
        firebase.auth().signInWithEmailAndPassword("andremeinerz@hotmail.com", "123456").then(response => {
          console.log('success', response)
        }).catch(error => {
          console.log('error', error)
        });
        console.log('depois')


      
    </script>

APARECE ISSO NO CONSOLE. Alguém pode me ajudar.. segui os passos de um vídeo, e o dele da certo..

Via Active questions tagged javascript - Stack Overflow https://ift.tt/xvRB10Q

Comments

Popular posts from this blog

Why is my reports service not connecting?

I am trying to pull some data from a Postgres database using Node.js and node-postures but I can't figure out why my service isn't connecting. my routes/index.js file: const express = require('express'); const router = express.Router(); const ordersCountController = require('../controllers/ordersCountController'); const ordersController = require('../controllers/ordersController'); const weeklyReportsController = require('../controllers/weeklyReportsController'); router.get('/orders_count', ordersCountController); router.get('/orders', ordersController); router.get('/weekly_reports', weeklyReportsController); module.exports = router; My controllers/weeklyReportsController.js file: const weeklyReportsService = require('../services/weeklyReportsService'); const weeklyReportsController = async (req, res) => { try { const data = await weeklyReportsService; res.json({data}) console...

How to show number of registered users in Laravel based on usertype?

i'm trying to display data from the database in the admin dashboard i used this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count(); echo $users; ?> and i have successfully get the correct data from the database but what if i want to display a specific data for example in this user table there is "usertype" that specify if the user is normal user or admin i want to user the same code above but to display a specific usertype i tried this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count()->WHERE usertype =admin; echo $users; ?> but it didn't work, what am i doing wrong? source https://stackoverflow.com/questions/68199726/how-to-show-number-of-registered-users-in-laravel-based-on-usertype

The number of nodes and edges I calculated manually and by a method provided by networkx library dont match

I am trying to analyse a graph using networkx library in Python. I have implemented a function that returns the nodes and edges of that graph. After that I counted the number of nodes and edges by implementing the len() function for nodes and edges, which gave me 17 for both nodes and edges. However, when I used the method graph.number_of_nodes() of networkx library it gave me 53. My code: import pandas as pd import networkx as nx import matplotlib.pyplot as plt header_list = ["a","b","w"] E =pd.read_csv("aves-barn-swallow-contact-network.edges",sep=" ",header= None,names=header_list) # print(E.head()) # prints first few rows of the csv file G = nx.from_pandas_edgelist(E,"a","b",["w"]) nx.draw(G) plt.show() class GraphAnalyse: #finding nodes and edges def nodeEdge(self,Graph): nodes = Graph.nodes() edges = Graph.edges() ...