Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
SimpleUserWrongPassword('Old password is invalid');
  • Heres my code in controller function edit 
    (Old password is invalid)
    public function action_edit($id = null)
    {
    $user = Model_User::find($id);
    //$val = Model_User::validate('edit');

    // if ($val->run())
    // {

    //simple auth update user

            $user = Auth::update_user(
    array(
    'email' => Input::post('email'),
    'password' => Input::post('password'),
    'old_password' => Input::post('oldpassword'),
    )
    );

    if ($user)
    {
    Session::set_flash('success', e('Updated user #' ));

    Response::redirect('admin/users');
    }
    else
    {
    if (Input::method() == 'POST')
    {
    $user = Auth::update_user(
    array(
    'email' => $val->validated('email'),
    'password' => $val->validated('password'),
    'old_password' => $val->validated('oldpassword'),
    )
    );
    Session::set_flash('error', $val->error());
    }

    $this->template->set_global('user', $user, false);
    }

    $this->template->title = "Users";
    $this->template->content = View::forge('admin/users/edit');

    }
  • And what is the question?
  • HarroHarro
    Accepted Answer
    That exception is thrown if the old password is empty, or doesn't match:

    if (empty($values['old_password'])
        or $current_values->get('password') != $this->hash_password(trim($values['old_password'])))
    {
        throw new \SimpleUserWrongPassword('Old password is invalid');
    }

    Doesn't match may mean you typed in the wrong password, but may also mean the salt or the interation number in the auth config has changed.
  • thanks a lot bro  :)

Howdy, Stranger!

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

In this Discussion