Created
March 30, 2014 15:58
-
-
Save ufasoli/9874880 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object CookieActionWrapper extends Controller { | |
| val emailCookie = "email" | |
| def ActionWrapper[A](action: Action[A]) = Action.async(action.parser) { | |
| implicit request => | |
| val cookie = request.cookies.get(emailCookie) | |
| // user needs to register before answering to any question | |
| if (cookie == None) { | |
| Future(BadRequest(views.html.errors.not_registered())) | |
| } | |
| else { | |
| action(request) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment