Playframework 播放身份验证注销重定向
我已经在Play 2.0.4项目中集成了Play认证模块。我的项目有两个视图,传统的web视图和移动视图。当应用程序注销时,它只返回到索引页面。在routes表中,我看到注销功能指向以下方面:Playframework 播放身份验证注销重定向,playframework,play-authenticate,Playframework,Play Authenticate,我已经在Play 2.0.4项目中集成了Play认证模块。我的项目有两个视图,传统的web视图和移动视图。当应用程序注销时,它只返回到索引页面。在routes表中,我看到注销功能指向以下方面: GET /logout com.feth.play.module.pa.controllers.Authenticate.logout 在模块代码中看起来像这样: public static Result logout() { no
GET /logout com.feth.play.module.pa.controllers.Authenticate.logout
在模块代码中看起来像这样:
public static Result logout() {
noCache(response());
return PlayAuthenticate.logout(session());
}
应用程序的工作方式是有一个main.scala.html文件,其中包含web应用程序需要的css/js链接,还有一个mobile_main.scala.html页面,其中包含移动模板内容使用的css/js。我遇到的问题是,当我退出应用程序(移动或web)时,我会被重定向到web应用程序的索引index.scala.html。是否有必要更改此设置,以便在适当的时候将我定向到移动索引页面
谢谢
编辑:这也适用于成功登录后应用程序返回的页面
好的,在进一步研究之后,我将问题追溯到Global.java。我想我需要改变下面的方法来解决我的问题。因此,我可以根据传递的参数加载不同的页面
@Override
public Call login() {
// Your login page
return routes.Application.login();
}
@Override
public Call afterAuth() {
// The user will be redirected to this page after authentication
// if no original URL was saved
return routes.Application.index();
}
@Override
public Call afterLogout() {
return routes.Application.index();
}
其中一种方法是在会话中保存您的状态,例如,您可以有两种状态:
mobile session
和web session
,然后在重定向之前在条件中验证这一点
if mobile session then redirect mobile index else redirect index