Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [2016-09-18 11:07:46] local.ERROR: exception 'IlluminateContractsEncryptionDecryptException' with message 'The payload is invalid.' in /home/vagrant/Code/bob/vendor/laravel/legacy-encrypter/src/BaseEncrypter.php:44
- <?php
- namespace AppConsoleCommands;
- use AppUser;
- use IlluminateConsoleCommand;
- use LaravelLegacyEncrypterMcryptEncrypter;
- class McryptToOpenSSL extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'key:migrate';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Migrates key from deprecated Mcrypt to OpenSSL.';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $legacy = new McryptEncrypter(env('APP_KEY_LEGACY'));
- $users = User::all();
- foreach ($users as $user) {
- $user->password = encrypt(
- $legacy->decrypt($user->pasword)
- );
- $user->save();
- }
- }
- }
- APP_ENV=local
- APP_DEBUG=true
- APP_KEY=base64:3VU8u79ZU0dObazwvd2lHHOAVRJjy5kvzXKeKtcHVYk=
- APP_KEY_LEGACY=zejqrdy7WjA58xGoSuj634RYXB97vLyp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement