Estoy creando una función de registro con React y Firebase en este momento, y cuando me registro, quiero enviar un código de autenticación al correo electrónico que escribe el usuario. Soy un principiante, por lo que el código puede ser extraño, pero ¿hay alguna forma de enviar el código de verificación desde este código?
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> </>; }