2017-02-13 60 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 
} 
...