Can not set cookie in symfony app. How to fix it?

It can’t set cookie on my PC.
I am working with my brother and it works for him on his PC

if (isset($_POST["stay_logged"])) {     
   setcookie("user_code", $user->getCode(), null, "/");
   $this->session->set("user_code", $user->getCode());
}

isset($_POST["stay_logged"]) return true, “stay_logged” is name of checkbox.

sign_in.html.twig

<form method='POST' class="sign_in_form">

    <input class="text-input text-input--material" name="login" placeholder="username or email" type="text">
    <br />
    <input class="text-input text-input--material" name="password" placeholder="password" type="password">

    {% if error is defined %}
        {{ error }}
    {% endif %}

    {% if error2 is defined %}
        {{ error2 }}
    {% endif %}

    <input type="checkbox" class="filled-in" name="stay_logged"/>     // my checkbox here
    <label for="stay_logged">Remember me</label>
    <input type='submit' class="sign_in_form_submit" value='log in' name="submit">
</form>

I can not see my cookie in any way.
Can you halp? Thanks

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *