public function processApprove(string $hash): bool
    {
        $decode = $this->getDecodeHash($hash);

        $id = (int) $decode['id'];
        $verifyHash = $decode['verifyHash'];

        $item = $this->getById($id);  // load row from db
        if ($item && $id == $item['id']) { // not null result
            if (!$item['active']) {
                if ($this->verifyHash($item['id'] . $item['login'], $verifyHash)) {  // check hash and password
                    return $this->update($item['id'], ['active' => true]);    // final activate user
                } else {
                    throw new IdentityException('Invalid hash!');
                }
            } else {
                // basic check expire link (after click), next check is only active status not datetime! - execute update only if not active
                throw new IdentityException('User is already approve!');
            }
        } else {
            throw new IdentityException('User does not exist!');
        }
    }
public function processApprove(string $hash): bool
    {
        $decode = $this->getDecodeHash($hash);

        $id = (int) $decode['id'];
        $verifyHash = $decode['verifyHash'];

        $item = $this->getById($id);  // load row from db
        if ($item && $id == $item['id']) { // not null result
            if (!$item['active']) {
                if ($this->verifyHash($item['id'] . $item['login'], $verifyHash)) {  // check hash and password
                    return $this->update($item['id'], ['active' => true]);    // final activate user
                } else {
                    throw new IdentityException('Invalid hash!');
                }
            } else {
                // basic check expire link (after click), next check is only active status not datetime! - execute update only if not active
                throw new IdentityException('User is already approve!');
            }
        } else {
            throw new IdentityException('User does not exist!');
        }
    }
public function processApprove ( string $ hash ) : bool { $ decode = $ this -> getDecodeHash ( $ hash ) ; $ id = ( int ) $ decode [ 'id' ] ; $ verifyHash = $ decode [ 'verifyHash' ] ; $ item = $ this -> getById ( $ id ) ; // load row from db if ( $ item && $ id == $ item [ 'id' ] ) { // not null result if ( ! $ item [ 'active' ] ) { if ( $ this -> verifyHash ( $ item [ 'id' ] . $ item [ 'login' ] , $ verifyHash ) ) { // check hash and password return $ this -> update ( $ item [ 'id' ] , [ 'active' => true ] ) ; // final activate user } else { throw new IdentityException ( 'Invalid hash!' ) ; } } else { // basic check expire link (after click), next check is only active status not datetime! - execute update only if not active throw new IdentityException ( 'User is already approve!' ) ; } } else { throw new IdentityException ( 'User does not exist!' ) ; } }
Process approve.

@param string $hash
@return bool
@throws IdentityException
@throws \Dibi\Exception
Process approve .