Skip to content

want to get the Customer password at the time of Registration

Is there any way we get the customer password but not hashed!

I am trying this way but not getting

<?php

namespace VendorCustomerObserver;

use MagentoFrameworkEventObserverInterface;
use MagentoFrameworkEventObserver;
use PsrLogLoggerInterface;

class LogPassword implements ObserverInterface
{
    protected $logger;

    public function __construct(
        LoggerInterface $logger
    ) {
        $this->logger = $logger;
    }

    public function execute(Observer $observer)
    {
        $customer = $observer->getEvent()->getCustomer();
        $password = $observer->getEvent()->getData('password');

        if ($password) {
            $this->logger->info('Customer password: ' . $password);
        }
    }
}