Hello,
I am trying to get the cleartext password in a hook on saveReady in an autoload module. But I get the already hashed value of the password:
Session: pass: L1/CERxHKqXJCJkogk89O48b4bMnsqW
What I have
protected $templates = ["user", "server"];
public function init() {
$this->pages->addHookAfter('saveReady', $this, 'hookSaveReady');
}
public function hookSaveReady(HookEvent $event) {
$page = $event->arguments[0];
if($page->isNew) return;
if(!in_array($page->template, $this->templates)) return;
if($page instanceof User) $this->collectUserData($page);
}
public function collectUserData($page) {
foreach ($page->fields as $field) {
/*if( $page->isChanged($field) ) */$this->message($field->name . ": " . $page->$field);
}
}
I guess I am hooking too late in the process but have no idea where to place the hook instead.
EDIT: same with addHookBefore