Issue
I am working on a project. it's a support application.
After I close the ticket I send a satisfaction form to the customer via Email, it's a 5 star type of form.
I want to be able to get the data from the user and save it.
Exemple :
Tom had a problem with his order and our team fixes the problem. After closing the ticket.
I send a satisfaction form like this :
How good was our service Tom rate us please
Tom clicks on 4 stars.
This is how I am trying to solve the problem now:
Tom is redirected to a page that says "Thank you for your trust in our service"
and The rating is saved as a post method like this www.oursite.com\thankyou\4
now it should be easy to save tom's review in our server but the problem is :
TOM does not have access to oursite.com and he is redirected to the login page instead.
My question is: how to give tom access to www.oursite.com\thankyou as a visitor only.
This is my access Control in security.yml
access_control:
# - { path: ^/dashBoard, role: IS_AUTHENTICATED_REMEMBERED }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY, allow_if: "not has_role('ROLE_USER')" }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/faq/application, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/faq/category, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, role: IS_AUTHENTICATED_REMEMBERED }
- { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api/getToken, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
# This is the Thank you page
- { path: ^/thankYou, role: IS_AUTHENTICATED_ANONYMOUSLY}
if you need anything else please tell me. Maybe there is a better way to get data from an Email without redirecting the user to another page. And Thank you
Solution
I figured out how to do it. I had a firewall that redirect me to the login page everytime I am connected anonymously.
this is the firewall I am talking about :
backend:
pattern: ^/
provider: fos_userbundle
form_login:
csrf_token_generator: security.csrf.token_manager
login_path: /login
check_path: /login_check
default_target_path: dashboard
# success_handler: my_user_log.component.authentication.handler.login_success_handler
logout:
path: /logout
target: /login
# success_handler: my_user_log.component.authentication.handler.logout_success_handler # redirect, no_redirect, redirect_without_path
anonymous: true
and this is the firewall I had to add :
api_thankyou:
pattern: ^/mail
security: false
Answered By - hakam koubaa
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.