title: Delete user account Dialog - firebase with React JS
body: <p>This dialog must delete the user authentication info of the currently signed user:</p>
  <pre><code>import React, { Component } from 'react';
  import fire, { firestore } from '../config';
  
  var user = fire.auth().currentUser;
  var email = user ? user.email.toString() : &quot;&quot;;
  var password = &quot;&quot;;
  var typedPassword = &quot;&quot;;
  
  class DeleteConfirmationDialog extends Component {
  
      componentDidMount() {
          user = fire.auth().currentUser;
          email = fire.auth().currentUser.email;
          console.log(email)
          firestore.collection(&quot;User&quot;).where(&quot;email&quot;, &quot;==&quot;, email)
              .get()
              .then((querySnapshot) =&gt; {
                  querySnapshot.forEach((doc) =&gt; {
                      password = doc.data().password;
                  });
              })
              .catch((error) =&gt; {
                  console.log(&quot;Error getting documents: &quot;, error);
              });
      }
  
      del = (e) =&gt; {
          e.preventDefault();
          if (password === typedPassword) {
              firestore.collection(&quot;User&quot;).where('email', '==', email).get().then((snap) =&gt; {
                  snap.forEach((doc) =&gt; {
                      doc.ref.delete();
                      console.log(&quot;DOC FUNCTION&quot;)
                  })
              }).then(function () {
                  user.delete();
                  console.log(&quot;SUCCESS&quot;)
              })
                  .catch(function (error) {
                      console.log(error)
                  })
          } else {
              console.log(&quot;Password is NOT correct&quot;)
          }
      }
  
      handleInputChange = (e) =&gt; {
          typedPassword = e.target.value;
          console.log(password)
          console.log(typedPassword)
      }
  
      render() {
          return (
              &lt;center className='delete-Dialog' &gt;
                  &lt;p style={{ margin: '3px' }}&gt;For your security, please re-enter your password to continue&lt;/p&gt;
                  &lt;form&gt;
                      &lt;input type='password' placeholder='Password' className='inputForDelete' onChange={this.handleInputChange} /&gt;
                      &lt;br /&gt;
                      &lt;button className='continue' onClick={this.del}&gt;continue&lt;/button&gt;
                  &lt;/form&gt;
              &lt;/center&gt;
          );
      }
  }
  export default DeleteConfirmationDialog;
  </code></pre>
  <p>It should delete the authentication data and delete the User from firestore collection at the same time. When I click to submit, it says &quot;SUCCESS&quot; but I still see that user in the firebase and can login again, what may be the problem?</p>