title: Resetting password via email
body: <p>sorry for the long post, I'm trying to reset password via email, until now I managed to send the reset link to the email, right now I tried this in the backend:</p>
  <pre><code>userRouter.get('/reset', expressAsyncHandler(async (req, res) =&gt; {
    const user = await User.findOne({
      where: {
        resetPasswordToken: req.query.resetPasswordToken,
        resetPasswordExpires: {
          $gt: Date.now(),
        },
      },
    });
    if (user) {
      console.log('token matched')
      res.status(200).send({
        message: 'password reset link ok'
      })
    } else {
      console.log('password reset link is invalid or has expired');
      res.json('password reset link is invalid or has expired');
    }
  })
  );
  </code></pre>
  <p>In the forgot password I did something like this for updating the two field:</p>
  <pre><code>user.update({
          resetPasswordToken: token,
          resetPasswordExpires: Date.now() + 360000,
        });
  </code></pre>
  <p>My user Model is:</p>
  <pre><code>    name: { type: String, required: true },
      email: { type: String, required: true, unique: true },
      password: { type: String, required: true },
      isAdmin: { type: Boolean, default: false, required: true }
  </code></pre>
  <p>When I'm trying to use the where clause to check the resetPasswordToken is returning all my users, which is wrong. I'm thinking that I need to declare the resetPasswordToken and resetPasswordExpires in the model for it two work? Or it is enough? Another question would be, what would I have to send to the frontend so it will work?</p>
  <p>In react-redux, I have the following function, but I'm 100%, that I'm sending the wrong data:</p>
  <pre><code>export const checktoken = (email) =&gt; async (dispatch) =&gt; {
    dispatch({ type: USER_RESET_PASSWORD_REQUEST, payload: { email } });
    try {
      const { data } = await Axios.get('/api/users/reset');
      dispatch({ type: USER_RESET_PASSWORD_SUCCESS, payload: data });;
      localStorage.setItem('userInfo', JSON.stringify(data));
    } catch (error) {
      dispatch({
        type: USER_RESET_PASSWORD_FAIL,
        payload:
          error.response &amp;&amp; error.response.data.message
            ? error.response.data.message
            : error.message,
      });
    }
  };
  </code></pre>