Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9128393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:30:13+00:00 2026-06-17T07:30:13+00:00

According to the symfony 2 documentation, by default if a user tries to access

  • 0

According to the symfony 2 documentation, by default if a user tries to access a secure page they will be prompt to the login page, after a successful login they will be redirected to the original page they intend to. (Reference).

But in my application the user is always been redirected to the / no matter if they try to access mysite.com/blog/post/2/edit.

This is my security.yml:

jms_security_extra:
    secure_all_services: false
    expressions: true

security:
    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]

    providers:
        main:
            entity: {class: Done\PunctisBundle\Entity\User, property: username}

    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            remember_me:
                key: %secret%
                lifetime: 3600
                path: /
                domain: ~
            pattern: ^/
            anonymous: ~
            form_login:
                login_path: /login
                check_path: /login_check
            logout:
                path:   /logout
                target: /

    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/signup, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/verification, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/popup/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/ajax/track, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/ajax/socialbox, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/, roles: ROLE_USER }

    encoders:
        Done\PunctisBundle\Entity\User:
            algorithm:   md5
            iterations: 1
            encode_as_base64: false

And the login form:

<?php $view -> extend('DonePunctisBundle:TemplateBases:default.html.php'); ?>

<?php $view['slots']->start('body')
?>
    <h1 class="worldH1">
                Effettua il <span>login</span> su Punctis<br>e inizia a guadagnare!
         </h1>
         <div id="loginContent" class="container pageContent">
             <?php 
             if(isset($error)){
                 ?>
                <div class="alert alert-error">
                    <?=$error->getMessage() ?>
                </div>
                 <?php
             } else{?>
             <div class="alert">
                <strong>SEI NUOVO?</strong> Se non hai ancora un account, <a href="#">registrati</a> in meno di un minuto!
            </div>
            <?php } ?>
            <div id="loginForm">
                <div class="row">
                    <div class="span3">
                        <h2>Logina via Social</h2>
                         <p>
                            <a href="#" id="signupFacebookStart" class="socialButton">  <?=$this -> get('translator') -> trans('login.via.facebook', array(), 'front'); ?></a>
                        </p>

                        <p>
                            <a href="#" id="signupTwitterStart" class="socialButton tw">  <?=$this -> get('translator') -> trans('login.via.twitter', array(), 'front'); ?></a>
                        </p>
                    </div>
                    <div class="span4">

                        <div id="loginFormCanvas">
                            <h2>Logina via Mail</h2>
                        <form action="<?php echo $view['router']->generate('done_punctis_user_login_check') ?>" method="post">


                                             <label class="control-label required" for="login_email">Mail:</label>


                                                <input type="text" value="<?php echo (isset($last_username)? $last_username: null); ?>"  id="login_email" name="_username" class="input-large">







                                            <label class="control-label required"  for="login_email">Password:</label>

                                                <input type="password"  name="_password" value=""  id="login_email"  class="input-large">




        <label for="remember_me" class="checkbox"><input type="checkbox" id="remember_me" name="_remember_me" checked /> Remember me</label>
                                                <input type="hidden" name="_target_path" value="/" />
                                                <button class="btn btn-primary" type="submit">Login</button> <a id="loginForgetPass" href="#">Password Dimenticata?</a>

                                        </form>

                    </div>
                    <div class="clear"></div>
                    </div>

                </div>

            </div>

         </div>



<?php $view['slots']->stop() ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:30:15+00:00Added an answer on June 17, 2026 at 7:30 am

    By default, the form login strategy for the property path is, when a user tries to access a secured page without being authenticated, to store the path into the session before redirecting to the login page. So after successfully logging in, the user is redirected to this path. But are two ways of disabling this mechanism.

    If you set the always_use_default_target_path option to TRUE, no path will be stored and the user will always be redirected to the configured default_target_path (default /) after successfully loggin in.

    And if you add a _target_path parameter to your request, the user will be redirected to the path this parameter contains after successfully logging in.

    So in your example, the user is always redirected to the path / after logging in because you have a _target_path hidden field with the value / in your login form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to Hibernate documentation : After observing that arrays cannot be lazy , you
According to PHP.net manual, pg_pconnect will create a persistent connection, or will return the
According this article , generic JPA DAO(Data Access Object) is a pretty nice pattern.
According to the iNES documentation , ROM banks are 16kB. Is this 16000 bytes
According to this link, now we can use Request.Unvalidated to access a raw value
I'm trying to run my first template in symfony 2 according to Optional Step
This is a bit frustrating. According to Symfony best practices, a bundle's web assets
According to the official documentation , the KeyDown event on a Windows Forms control
I'm writing my first Symfony2 app after a few years with Symfony and am
I am developing a form in a Symfony application where a user must indicate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.