public function checkRehash(\Gems_User_User $user, $password)
    {
        if (! $this->canSaveNewHash()) {
            return false;
        }

        $model = new \MUtil_Model_TableModel('gems__user_passwords');
        $row   = $model->loadFirst(['gup_id_user' => $user->getUserLoginId()]);

        if ($row && password_needs_rehash($row['gup_password'], $this->getHashAlgorithm(), $this->getHashOptions())) {
            $data['gup_id_user']  = $user->getUserLoginId();
            $data['gup_password'] = $this->hashPassword($password);

            $model = new \MUtil_Model_TableModel('gems__user_passwords');
            \Gems_Model::setChangeFieldsByPrefix($model, 'gup', $user->getUserId());

            $model->save($data);

            return true;
        }

        return false;
    }
public function checkRehash(\Gems_User_User $user, $password)
    {
        if (! $this->canSaveNewHash()) {
            return false;
        }

        $model = new \MUtil_Model_TableModel('gems__user_passwords');
        $row   = $model->loadFirst(['gup_id_user' => $user->getUserLoginId()]);

        if ($row && password_needs_rehash($row['gup_password'], $this->getHashAlgorithm(), $this->getHashOptions())) {
            $data['gup_id_user']  = $user->getUserLoginId();
            $data['gup_password'] = $this->hashPassword($password);

            $model = new \MUtil_Model_TableModel('gems__user_passwords');
            \Gems_Model::setChangeFieldsByPrefix($model, 'gup', $user->getUserId());

            $model->save($data);

            return true;
        }

        return false;
    }
public function checkRehash ( \ Gems_User_User $ user , $ password ) { if ( ! $ this -> canSaveNewHash ( ) ) { return false ; } $ model = new \ MUtil_Model_TableModel ( 'gems__user_passwords' ) ; $ row = $ model -> loadFirst ( [ 'gup_id_user' => $ user -> getUserLoginId ( ) ] ) ; if ( $ row && password_needs_rehash ( $ row [ 'gup_password' ] , $ this -> getHashAlgorithm ( ) , $ this -> getHashOptions ( ) ) ) { $ data [ 'gup_id_user' ] = $ user -> getUserLoginId ( ) ; $ data [ 'gup_password' ] = $ this -> hashPassword ( $ password ) ; $ model = new \ MUtil_Model_TableModel ( 'gems__user_passwords' ) ; \ Gems_Model :: setChangeFieldsByPrefix ( $ model , 'gup' , $ user -> getUserId ( ) ) ; $ model -> save ( $ data ) ; return true ; } return false ; }
Checks if the current users hashed password uses the current hash algorithm.
If not it rehashes and saves the current password
@param  \Gems_User_User  $user     Current logged in user
@param  integer          $password Raw password
@return boolean          password has been rehashed
Checks if the current users hashed password uses the current hash algorithm . If not it rehashes and saves the current password