1

What is wrong on this code in CakePHP 3?

crypt function is ok, but when I am trying to decrypt password, it returns false.

  public function beforeSave($event){
    if(isset($event->data['entity']["password"])){
      $event->data['entity']["password"] =  Security::encrypt($event->data['entity']["password"], Security::salt());
    }
  }

  public function readPassword($pass){
     $result = Security::decrypt($pass, Security::salt());
     echo $result;
     die();
  }
Martin Hrabal
  • 102
  • 1
  • 2
  • 10

0 Answers0