I'd like to encrypt & decrypt my password using the following functions, but I'd like to use the vendor folder for Crypt.php
Create a Crypt class as the and use the controller to
App::uses('Crypt', 'Vendor');
If you call , you will not find the security class.
How will it work?
class Crypt {
static public function encrypt($text){
return base64_encode(Security::rijndael($text,Configure::read('constants.crypt_key'), 'encrypt'));
}
static public function decrypt($text){
return Security::rijndael(base64_decode($text), Configure::read('constants.crypt_key'), 'decrypt');
}
}
Crypt depends on the security class, so
Before Crypt.php Class Definition
App::uses('Security', 'Utility');
Please add
Why don't you define components within your controller?
public$components=['Security');
© 2024 OneMinuteCode. All rights reserved.