Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Lumen] CSRF nie działa.
mrWodoo
post
Post #1





Grupa: Zarejestrowani
Postów: 160
Pomógł: 6
Dołączył: 13.01.2012
Skąd: Bytom

Ostrzeżenie: (0%)
-----


Witam, mam problem, gdyż nie potrafię zabezpieczyć formularzy przed CSRF przy użyciu wbudowanego w framework Lumena systemu, gdyż funkcja csrf_token() nic nie zwraca, nie ma też błędów, wszystko odblokowane w app.php.
Proszę o pomoc (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
mrWodoo
post
Post #2





Grupa: Zarejestrowani
Postów: 160
Pomógł: 6
Dołączył: 13.01.2012
Skąd: Bytom

Ostrzeżenie: (0%)
-----


  1. <?php
  2.  
  3. require_once __DIR__.'/../vendor/autoload.php';
  4.  
  5. Dotenv::load(__DIR__.'/../');
  6.  
  7. /*
  8. |--------------------------------------------------------------------------
  9. | Create The Application
  10. |--------------------------------------------------------------------------
  11. |
  12. | Here we will load the environment and create the application instance
  13. | that serves as the central piece of this framework. We'll use this
  14. | application as an "IoC" container and router for this framework.
  15. |
  16. */
  17.  
  18. $app = new Laravel\Lumen\Application;
  19.  
  20. // $app->withFacades();
  21.  
  22. // $app->withEloquent();
  23.  
  24. /*
  25. |--------------------------------------------------------------------------
  26. | Register Container Bindings
  27. |--------------------------------------------------------------------------
  28. |
  29. | Now we will register a few bindings in the service container. We will
  30. | register the exception handler and the console kernel. You may add
  31. | your own bindings here if you like or you can make another file.
  32. |
  33. */
  34.  
  35. $app->singleton(
  36. 'Illuminate\Contracts\Debug\ExceptionHandler',
  37. 'App\Exceptions\Handler'
  38. );
  39.  
  40. $app->singleton(
  41. 'Illuminate\Contracts\Console\Kernel',
  42. 'App\Console\Kernel'
  43. );
  44.  
  45. $app->singleton(
  46. 'PageHelper',
  47. function($app) {
  48. return new \App\Helpers\PageHelper( $app );
  49. }
  50. );
  51.  
  52. $app->singleton(
  53. 'MailHelper',
  54. function($app) {
  55. return new \App\Helpers\MailHelper( $app );
  56. }
  57. );
  58.  
  59. $app->singleton(
  60. 'PricingHelper',
  61. function($app) {
  62. return new \App\Helpers\PricingHelper( $app );
  63. }
  64. );
  65.  
  66. /*
  67. |--------------------------------------------------------------------------
  68. | Register Middleware
  69. |--------------------------------------------------------------------------
  70. |
  71. | Next, we will register the middleware with the application. These can
  72. | be global middleware that run before and after each request into a
  73. | route or middleware that'll be assigned to some specific routes.
  74. |
  75. */
  76. $app->middleware([
  77. // 'Illuminate\Cookie\Middleware\EncryptCookies',
  78. // 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
  79. 'Illuminate\Session\Middleware\StartSession',
  80. // 'Illuminate\View\Middleware\ShareErrorsFromSession',
  81. 'Laravel\Lumen\Http\Middleware\VerifyCsrfToken',
  82. ]);
  83.  
  84. $app->routeMiddleware([
  85. 'csrf' => 'Laravel\Lumen\Http\Middleware\VerifyCsrfToken'
  86. ]);
  87. /*
  88. |--------------------------------------------------------------------------
  89. | Register Service Providers
  90. |--------------------------------------------------------------------------
  91. |
  92. | Here we will register all of the application's service providers which
  93. | are used to bind services into the container. Service providers are
  94. | totally optional, so you are not required to uncomment this line.
  95. |
  96. */
  97.  
  98.  
  99.  
  100. /*
  101. |--------------------------------------------------------------------------
  102. | Load The Application Routes
  103. |--------------------------------------------------------------------------
  104. |
  105. | Next we will include the routes file so that they can all be added to
  106. | the application. This will provide all of the URLs the application
  107. | can respond to, as well as the controllers that may handle them.
  108. |
  109. */
  110.  
  111. require __DIR__.'/../app/Http/routes.php';
  112.  
  113.  
  114. return $app;
Go to the top of the page
+Quote Post

Posty w temacie
- mrWodoo   [Lumen] CSRF nie działa.   27.04.2015, 19:43:59
- - memory   [PHP] pobierz, plaintext $app->routeMiddleware...   27.04.2015, 19:50:12
- - mrWodoo   mam [PHP] pobierz, plaintext $app->get('/...   27.04.2015, 19:51:54
- - memory   może to głupie ale spróbuj zakomentować 'Lara...   27.04.2015, 19:55:03
- - mrWodoo   Na moje nieszczęście nic to nie dało Oczywiście ...   28.04.2015, 10:08:03
|- - memory   Cytat(mrWodoo @ 28.04.2015, 11:08:03 ...   28.04.2015, 10:59:57
- - viking   Ostatnio przeglądałem trochę kod Laravela w tym wz...   28.04.2015, 10:25:50
- - mrWodoo   Nie zgadza się bo csrf_token() zwraca mi pusty str...   28.04.2015, 10:45:39
- - Pyton_000   composer update i potem sprawdzaj czy nadal nie dz...   28.04.2015, 11:14:03
- - mrWodoo   Kod widoku tu nie ma znaczenia, po prostu nie dzia...   28.04.2015, 11:43:40
- - Pyton_000   Zainstalowałem świeżego Lumena i: app.php: [PHP] ...   28.04.2015, 11:52:30
- - mrWodoo   Ok, a więc udało mi się pobrać csrf token, ale tyl...   28.04.2015, 12:02:31
- - Pyton_000   no dobra.. Szukamy dalej. routes.php [PHP] pobierz...   28.04.2015, 12:43:32
- - mrWodoo   wyświetla null   28.04.2015, 12:54:58
- - Pyton_000   pokaż cały app.php   28.04.2015, 12:59:41
- - mrWodoo   [PHP] pobierz, plaintext <?php require_onc...   28.04.2015, 13:00:34
- - Pyton_000   zmień SESSION_DRIVER na file w .env lub memcached ...   28.04.2015, 13:21:14
- - mrWodoo   Ok, problem pojawia się gdy przekazuję jakieś para...   28.04.2015, 13:27:02
- - Pyton_000   Wywal z konstruktora parametry i dodawaj na zmianę...   28.04.2015, 13:53:32
- - mrWodoo   Muszę wywalić wszystkie helpery... a definicja ni...   28.04.2015, 14:35:16
- - Pyton_000   Jak możesz to spakuj gdzieś całość (bez vendor ocz...   28.04.2015, 14:36:40


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 28.12.2025 - 08:30