0

What's up guys!

I developed a system locally and it worked perfectly. When I put the system on the web server it started to give this error.

The page has expired due to inactivity.

I would not like to put the routes as an exception from csrf. One reason is that the system will be accessed by several people

The server has the required permissions on the storage folder.

My head:

  <meta name="csrf-token" content="{{csrf_token()}}"/>

My form looks like this:

<form id="login" role="form" method="post" autocomplete="off" action="{{route('postLogar')}}">
{{csrf_field()}}
<div class="col-md-12">
    <div class="row">
        <div class="col-xs-6 col-md-6">
            <input type="text" id="nr_cpf" name="nr_cpf" class="form-control input-lg"
            value="" placeholder="CPF" maxlength="11" onBlur="validarCPF(this.value);" required/>
        </div>
        <div class="col-xs-6 col-md-6">
            <input type="text" id="nr_matricula" name="nr_matricula" class="form-control input-lg"
            value="" placeholder="Matrícula" maxlength="8" style="text-transform: capitalize" required/>
        </div>
    </div>
    <br>
    <div class="row">
        <div class="col-xs-6 col-md-6">
            <input type="password" id="ds_senha" name="ds_senha" class="form-control input-lg"
            value="" placeholder="Senha" minlength='10' maxlength="10" required/>
        </div>
        <div class="col-xs-6 col-md-6">
        </div>
    </div>
    <br>
    <div class="row">
        <div class="col-xs-3 col-md-3">
        </div>
        <div class="col-xs-6 col-md-6">
            <button class="btn btn-success btn-block btn-lg" type="submit">
                Entrar
            </button>
        </div>
        <div class="col-xs-3 col-md-3">
        </div>
    </div>
</div>

My route:

Route::post('/logar', 'ViewController@postLogar')->name('postLogar');

Session.php

'driver' => env('SESSION_DRIVER', 'file'),
'secure' => env('SESSION_SECURE_COOKIE', false),
'domain' => env('SESSION_DOMAIN', null),

I have other laravel systems running on that same web server and they all work normally. I have no idea what may be happening.

  • *"I have other laravel systems running on that same web server"* That *might* have something to do with it. Try setting `'cookie' => 'laravel_session',` to something unique to that project in `config/session.php`. – Tim Lewis Jul 23 '18 at 18:09
  • @TimLewis I tried to do what you recommended. Unfortunately unsuccessful – douglas pjuizfora Jul 23 '18 at 18:20
  • Hence the *might*. I forget the context I ran into when I had to change that on one of my projects, but it must have been something different. – Tim Lewis Jul 23 '18 at 18:25

2 Answers2

0

Your laravel project directory might not have correct permissions to store the session stuff. Try giving correct permissons to these directories.

sudo chmod -R 777 storage
sudo chmod -R 777 bootstrap/cache

Navigate to your project root directory in Terminal / Command Promt and run these commands.

0

I discovered what was causing the problem on my system.

I Refined the Forms Request Part.

I used to do this before:

$nr_cpf = Input::get('nr_cpf_servidor');

I modified the code for this:

$nr_cpf = $request->nr_cpf;

Passing the request as object.

With this change ended up working my code. I do not know if the old form was giving conflict. But now it's working perfectly.