Jump to content

Get cleartext password in hook


gebeer
 Share

Recommended Posts

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...