本文介绍了重定向到单击(引用)链接的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一种情况,用户会从系统收到带有特定链接的电子邮件,该链接需要登录.比如说链接是http://test.url.com/product/2
.单击此链接的位置会将用户重定向到登录页面,并应在成功登录后重定向到收到的URL.
I have a scenario where the user receives an email from the system with a specific link which requires login. say for example the link is http://test.url.com/product/2
. Where clicking on this link redirects the user to the sign in page and should redirect to the received url upon success login.
但是我遇到的问题是系统始终将重定向到默认位置http://test.url.com/dashboard
.
But the issue I am having is the system always redirects to the default location which is http://test.url.com/dashboard
.
但是,当我单击电子邮件中的链接时,它始终返回null
,但是,当我注销系统并登陆登录页面时,它将返回正确的引荐来源网址.
security:
providers:
in_memory:
memory: ~
webservice:
id: user_provider
encoders:
Project\Bundle\LoginBundle\Security\User\User: plaintext
access_control:
- { path: ^/signin, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: "^/(signup|forgotpassword|resetpassword/[0-9a-z]+)?$", roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }
firewalls:
secured_area:
pattern: ^/
anonymous: ~
form_login:
login_path: /signin
check_path: _security_check
access_denied_url: forgotpassword
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
default:
anonymous: true
推荐答案
$request->getSession()->set('referer', $request->attributes->all());
access_control:
- { path: ^/product/.*, roles: IS_AUTHENTICATED_REMEMBERED }
这篇关于重定向到单击(引用)链接的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!