Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Warden send_reset_password_instructions
  • Hello,

    i am using long time fuelphp but i am new to the community forums. I have a question about warden resset functionality i am trying to resset password like this:





    public function post_forgot()
    {
    try
    {
    $user = new \Model_User();
    $user->email = Input::post('mail');
    $user->username = Input::post('username');
    $user->send_reset_password_instructions();
    return $this->response(
    array(
    'send' => true
    )
    );
    }
    catch(Exception $ex)
    {
    return $this->response(
    array(
    'send' => false,
    'message' => $ex->getMessage()
    )
    );

    }
    }


    ther probelm is that it asks me the password to resset the password!

    Exception = Password is required

    Thank you
  • The solution was in the documentation but i didnt see this at first..





    if (($user = Model_User::find('first', array('where' => array('email' => 'myemail@warden.net'))))) {
    try {
    $user->send_reset_password_instructions();
    } catch (Exception $ex) {
    echo sprintf('Oops, something went wrong: %s', $ex->getMessage());
    }
    }
  • Hello,

    I have also implemented this excellent package, 'Warden'.
    I'm writing here, because I have a small 'problem' with this section 'reset password'.

    I have a login form view which has also a link 'Forgot password ?'.

    The link sens to a controller 'forgotPassword' which triggers a view and asks the user to insert his email address in order to receive the reset_password_instructions.

    After the user inserts his email address I check in the database, and if the user is valid, I send him through Warden the reset_password_instructions, with the url to another controller named resetPassword

    What I don't get here is how should the flow look like ?

    The user click the link in the email, and comes to my resetPassword controller, together with the reset_password_token.

    What should I do now ? because the user has to set a new password in order to be able to use the method : reset_password_by_token($reset_token, $password);

    Where should I put the form fields for the new password ? In the form which asks for his email address to send him the reset_password_instructions.

    If yes, where do I keep the password, until I receive the reset_password_token ? I save it in the database in the 'password'  column without to encrypt her ... or ?

    I have to create another form, after I receive the token, and ask for the new password ?

    Please help me with a guideline for this workflow.

    Thanks.
  • There are generally two methods:

    Or you ask for the new password on the page you get to when you click on the link in the email, or you do a forced login in the controller the link points to, and then redirect to the controller in your application that deals with setting a new password (which your app should have somewhere).

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion