【问题标题】:Ember simple auth: how to redirect back to the last visiting route after authentication?Ember简单身份验证:身份验证后如何重定向回上一次访问路由?
【发布时间】:2023-03-29 01:15:01
【问题描述】:

如果用户尝试访问/protected-route,然后在/login 路由上完成用户身份验证后使用ember-simple-auth,如何将用户重定向回/protected-route

身份验证后有定义路由的配置,但是如何完成这样的事情呢?

【问题讨论】:

    标签: ember.js ember-simple-auth


    【解决方案1】:

    您应该在应用程序路由中混入ApplicationRouteMixin,用户将在登录后转换到protected route

    有关详细信息,请参阅 http://ember-simple-auth.com/api/classes/ApplicationRouteMixin.html 上的 ApplicationRouteMixin 文档和 sessionAuthenticated 方法

    【讨论】:

    • 你为我指明了正确的方向。我在应用程序路线上有那个最大值,但我正在根据其他一些似乎禁用这种内置行为的条件进行强制转换。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多