Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

517
Visualizações
How to create an account with Firebase and send a verification email to that email?

I'm making a signup function with react and firebase right now, and when I sign up, I want to send an authentication code to the e-mail that the user writes. I'm a beginner, so the code may be weird, but is there a way to send the verification code from this code?`

import React, { useRef, useState } from 'react';
import { Card, Button, Form, Alert } from "react-bootstrap"
import { useAuth } from '../contexts/AuthContext';

export default function Signup() {

    const emailRef = useRef()
    const passwordRef = useRef()
    const passwordComfirmRef = useRef()
    const { signup, currentUser } = useAuth()
    const [error, setError] = useState("")
    const [loading, setLoading] = useState(false)

    async function handleSubmit(e){
        e.preventDefault()

        if(passwordRef.current.value !== 
            passwordComfirmRef.current.value){
            return setError('Passwords do not match')
        }

       try{
        setError("")
           setLoading(true)
           await signup(emailRef.current.value, passwordRef.current.value)
       } catch{
        setError('we cant create account')
       }

         setLoading(false)
    }

  return <>
      <Card>
          <Card.Body>
              <h2 className="text-center mb-4">register</h2>
              {currentUser && currentUser.email}
              {error && <Alert className='alert alert-danger'>{error}</Alert>}
            <Form onSubmit={handleSubmit}>
              <Form.Group  className='mb-2'  id="email">
                <Form.Label>email</Form.Label>
                <Form.Control type="email" ref={emailRef}   />
              </Form.Group>
              <Form.Group className='mb-2'  id="password">
                <Form.Label>password</Form.Label>
                <Form.Control type="password" ref={passwordRef}  />
              </Form.Group>
              <Form.Group  className='mb-4' id="email">
                <Form.Label>password comfirm</Form.Label>
                <Form.Control type="password" ref={passwordComfirmRef}  />
              </Form.Group>
              <Button disabled={loading} className='w-100' type='submit'>
                  register
                </Button>
                <div className='w-100 text-center mt-3'>
                    do you have account? <a className='text-primary'>lgoin</a> 
                </div>
              </Form>
          </Card.Body>
      </Card>
     

  </>;
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda