async store({ request, response }) {
    try {
      const email = request.input("email");
      const user = await User.findByOrFail("email", email);

      user.token = crypto.randomBytes(10).toString("hex");
      user.token_created_at = new Date();

      await user.save();

      await Mail.send(
        ["emails.forgot_password", "emails.forgot_password-text"],
        {
          email,
          token: user.token,
          link: `${request.input("redirect_url")}?token=${user.token}`
        },
        message => {
          message
            .to(user.email)
            .from("kauagabrielsemenov@gmail.com", "Kaua | Real")
            .subject("Password recovery");
        }
      );
    } catch (err) {
      return response
        .status(err.status)
        .send({ error: { message: "E-mail not found" } });
    }
  }
/**
   * Create a new password
   * POST passwords
   */
Create a new password
POST passwords
Create a new password POST passwords
async store({ request, response }) {
    try {
      const email = request.input("email");
      const user = await User.findByOrFail("email", email);
      user.token = crypto.randomBytes(10).toString("hex");
      user.token_created_at = new Date();
      await user.save();
      await Mail.send(
        ["emails.forgot_password", "emails.forgot_password-text"],
        {
          email,
          token: user.token,
          link: `${request.input("redirect_url")}?token=${user.token}`
        },
        message => {
          message
            .to(user.email)
            .from("kauagabrielsemenov@gmail.com", "Kaua | Real")
            .subject("Password recovery");
        }
      );
    } catch (err) {
      return response
        .status(err.status)
        .send({ error: { message: "E-mail not found" } });
    }
  }
async store ( { request , response } ) { try { const email = request . input ( "email" ) ; const user = await User . findByOrFail ( "email" , email ) ; user . token = crypto . randomBytes ( 10 ) . toString ( "hex" ) ; user . token_created_at = new Date ( ) ; await user . save ( ) ; await Mail . send ( [ "emails.forgot_password" , "emails.forgot_password-text" ] , { email , token : user . token , link : ` ${ request . input ( "redirect_url" ) } ${ user . token } ` } , message => { message . to ( user . email ) . from ( "kauagabrielsemenov@gmail.com" , "Kaua | Real" ) . subject ( "Password recovery" ) ; } ) ; } catch ( err ) { return response . status ( err . status ) . send ( { error : { message : "E-mail not found" } } ) ; } }
Create a new password
 POST passwords
Create a new password POST passwords