Hi,
I'm thinking about making an action composition that will redirect user to a page when they're authorized. How do I do that? Here's my current code:
def onlyUnauthorized(f: Request[AnyContent] => Result): Action[AnyContent] = {
Action{ implicit request =>
if(SecurityHelper.isAuthenticated(request)) {
Results.Redirect(routes.Application.index)
}
f(request)
}
}
But it didn't work (I think because the reutrn value is Action[AnyContent] while redirect don't do that. How do I implement thsi if I want to? Thanks before.