FOSUserBundle-如何在用户发送注册表格后将其保留在主页上



我使用{% render url('fos_user_registration_register') %}在主页上呈现我的注册表格。一切都很好,但当用户发送此表单时,Symfony会将他重定向到默认的FOSUserBundle注册页面,这是我的问题,因为我想在主页上再次呈现此表单(有错误或成功消息)。我完全不知道怎么做!有可能吗?

我在登录表单上也遇到了同样的问题,但我在security.yml:中使用了此代码

firewalls:
        main:
            form_login:
                login_path: acme__my_homepage
                check_path: fos_user_security_check
                failure_path: acme__my_homepage

但我找不到以上注册选项。。。

我的文件:

src\MyBundle\Resources\views\homepage.html.twitch

<div class="window">
{% render url('fos_user_registration_register') %}
</div>

app\Resources\FOSUserBundle\views\register.html.twitch

<form>
    <input class="myCustomFormInput" name="username" />
    <input class="myCustomFormInput" name="email" />
    <input class="myCustomFormInput" name="password" />
    <input class="myCustomFormInput" name="rpassword" />
    <button type="submit">Send</button>
</form>

您可以挂接Fos控制器:https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/controller_events.md

有一些重置密码的练习,你必须像registration_success事件一样进行。只需返回RedirectResponse。

最新更新