6
With Play!框架2.0,使用Security Trait:在玩! 2.0 with Security trait如何在登錄後重定向到原始URL?
如果我讓用戶瀏覽到未經身份驗證的站點的幾個部分,但他們需要進行身份驗證的某些操作,我如何在身份驗證之前將它們重定向到其原始URL,而不是相同的URL所有?
這對Play這個問題有類似的要求! 1.x Playframework's Secure module is not redirecting to the original url after login。
但據我所知,原始URL的flash參數在2.0中不可用。
Basicaly我正在尋找將在身份驗證方法處理
def authenticate = Action { implicit request =>
loginForm.bindFromRequest.fold(
formWithErrors => BadRequest(html.login(formWithErrors)),
user => Redirect(routes.Application.index).withSession(Security.username -> user._1)
)
}
當某種重定向(originalRequestUrl)將是得心應手的變化。
乾淨解決方案的任何想法?