Php TYPO3 7.6后端钩子:检查fe_用户密码是否已更改

Php TYPO3 7.6后端钩子:检查fe_用户密码是否已更改,php,typo3,typo3-7.6.x,Php,Typo3,Typo3 7.6.x,是否有TYPO3后端钩子来检查fe\u用户的密码是否已更改?我试过这个: public function processDatamap_preProcessFieldArray(array &$fieldArray, $table, $id, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) { if ($table === "fe_users" && stripos($id, 'NEW') === fals

是否有TYPO3后端钩子来检查
fe\u用户的密码是否已更改?我试过这个:

public function processDatamap_preProcessFieldArray(array &$fieldArray, $table, $id, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {
    if ($table === "fe_users" && stripos($id, 'NEW') === false){
        $pw = $fieldArray['password'];
        die($pw);
    }
}

问题是,它总是返回一个密码,要么是新密码,要么是散列密码(如果它已经存在),所以我不知道它是否是一个已更改的字段。有没有办法检查更改的字段?

似乎我找到了解决方案。不确定这是否是最好的,但到目前为止它仍然有效。我意识到,
processDatamap\u PrepreprocessFieldArray
是密码仍然以纯文本形式存在的地方,因此我需要使用它来使用注册表存储密码(后来它已经散列,因此对我来说不可用)

processDatamap\u afterDatabaseOperations
中的fieldArray值仅在值更改时设置,因此通过检查是否设置了密码密钥,我知道密码最初是否更改

这就是我的解决方案:

public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $pObj) {
    if ($table === "fe_users" && $status === "update" && isset($fieldArray['password'])) {
        //get the password
        $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
        $pw = $registry->get('be', 'lastPassword');

        //do whatever is necessary with the plain text password...

        //remove it
        $registry->remove('be', 'lastPassword');
    }
}

public function processDatamap_preProcessFieldArray(array &$fieldArray, $table, $id, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {
    if ($table === "fe_users" && stripos($id, 'NEW') === false){
        $pw = $fieldArray['password'];
        $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
        $registry->set('be', 'lastPassword', $pw);
    }
}

看来我找到了解决办法。不确定这是否是最好的,但到目前为止它仍然有效。我意识到,
processDatamap\u PrepreprocessFieldArray
是密码仍然以纯文本形式存在的地方,因此我需要使用它来使用注册表存储密码(后来它已经散列,因此对我来说不可用)

processDatamap\u afterDatabaseOperations
中的fieldArray值仅在值更改时设置,因此通过检查是否设置了密码密钥,我知道密码最初是否更改

这就是我的解决方案:

public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $pObj) {
    if ($table === "fe_users" && $status === "update" && isset($fieldArray['password'])) {
        //get the password
        $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
        $pw = $registry->get('be', 'lastPassword');

        //do whatever is necessary with the plain text password...

        //remove it
        $registry->remove('be', 'lastPassword');
    }
}

public function processDatamap_preProcessFieldArray(array &$fieldArray, $table, $id, \TYPO3\CMS\Core\DataHandling\DataHandler &$pObj) {
    if ($table === "fe_users" && stripos($id, 'NEW') === false){
        $pw = $fieldArray['password'];
        $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
        $registry->set('be', 'lastPassword', $pw);
    }
}

请更具体地说明“更改”是什么意思!更改了什么(以前的值)?在哪里换的?当您将$id与'NEW'进行比较时,我假设它是关于新创建的fe_用户,但fe_用户可以通过多种方式创建。从FE中的不同扩展名开始,每个FE扩展名都有很多选项。不,这不是关于新条目,而是当有人在后端编辑用户时-我想在保存后查看密码是否更改。编辑是原封不动还是输入了新密码?请更具体地说明“更改”是什么意思!更改了什么(以前的值)?在哪里换的?当您将$id与'NEW'进行比较时,我假设它是关于新创建的fe_用户,但fe_用户可以通过多种方式创建。从FE中的不同扩展名开始,每个FE扩展名都有很多选项。不,这不是关于新条目,而是当有人在后端编辑用户时-我想在保存后查看密码是否更改。编辑是保留了原来的密码还是输入了新密码?