Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. [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
  2.  
  3. <?php
  4. namespace AppConsoleCommands;
  5.  
  6. use AppUser;
  7. use IlluminateConsoleCommand;
  8. use LaravelLegacyEncrypterMcryptEncrypter;
  9.  
  10. class McryptToOpenSSL extends Command
  11. {
  12. /**
  13. * The name and signature of the console command.
  14. *
  15. * @var string
  16. */
  17. protected $signature = 'key:migrate';
  18.  
  19. /**
  20. * The console command description.
  21. *
  22. * @var string
  23. */
  24. protected $description = 'Migrates key from deprecated Mcrypt to OpenSSL.';
  25.  
  26. /**
  27. * Create a new command instance.
  28. *
  29. * @return void
  30. */
  31. public function __construct()
  32. {
  33. parent::__construct();
  34. }
  35.  
  36. /**
  37. * Execute the console command.
  38. *
  39. * @return mixed
  40. */
  41. public function handle()
  42. {
  43. $legacy = new McryptEncrypter(env('APP_KEY_LEGACY'));
  44. $users = User::all();
  45. foreach ($users as $user) {
  46. $user->password = encrypt(
  47. $legacy->decrypt($user->password)
  48. );
  49.  
  50. $user->save();
  51. }
  52. }
  53. }
  54.  
  55. APP_ENV=local
  56. APP_DEBUG=true
  57. APP_KEY=base64:3VU8u79ZU0dObazwvd2lHHOAVRJjy5kvzXKeKtcHVYk=
  58. APP_KEY_LEGACY=zejqrdy7WjA58xGoSuj634RYXB97vLyp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement