2017-02-13 35 views
0

如何在不重定向的情况下使用ember简单验证来记录用户?使用Ember简单验证登录而不重定向简单验证

认证代码如下所示:

session.authenticate(
    'authenticator:oauth2-password-grant', 
    identification, 
    password, 
    ['read', 'write'] 
) 

然而,它重定向因为在我environment.js文件中配置的:

ENV['ember-simple-auth'] = { 
    authenticationRoute: 'login', 
    routeAfterAuthentication: 'accounts.index', 
    routeIfAlreadyAuthenticated: 'accounts.index' 
}; 

有一个参数或东西,我可以添加到验证呼叫绕过此路由器AfterAuthentication?

回答

0

在应用程序路径中,覆盖sessionAuthenticated方法。

routeAfterAuthentication的过渡方面所做的工作,因为你用ApplicationRouteMixin

//routes/application.js 

... 
sessionAuthenticated(){ 
    //do nothing or whatever 
} 
...