Login form in my app is realized via hidden form (which overlays the page and is displayed through data-toggle).
我的应用程序中的登录表单是通过隐藏的表单实现的(它覆盖页面并通过数据切换显示)。
It is nice and user friendly, however the problem occurs when unauthenticated user wants to access protected route - Ember Simple Auth wants to redirect to /login
. How to display login form in that case?
它很好用户友好,但是当未经身份验证的用户想要访问受保护的路由时会出现问题 - Ember Simple Auth想要重定向到/ login。在这种情况下如何显示登录表单?
1 个解决方案
#1
1
It's easy - in your application route override an sessionRequiresAuthentication
action. This action is defined in application-route-mixin, and by default looks like:
这很简单 - 在您的应用程序路由中覆盖sessionRequiresAuthentication操作。此操作在application-route-mixin中定义,默认情况如下:
sessionRequiresAuthentication: function() {
this.transitionTo(Configuration.authenticationRoute);
},
Instead of transitioning you may write a code to open a login form
您可以编写代码来打开登录表单,而不是转换
#1
1
It's easy - in your application route override an sessionRequiresAuthentication
action. This action is defined in application-route-mixin, and by default looks like:
这很简单 - 在您的应用程序路由中覆盖sessionRequiresAuthentication操作。此操作在application-route-mixin中定义,默认情况如下:
sessionRequiresAuthentication: function() {
this.transitionTo(Configuration.authenticationRoute);
},
Instead of transitioning you may write a code to open a login form
您可以编写代码来打开登录表单,而不是转换