remove UAFirewall

This commit is contained in:
Thibault Duplessis 2012-09-08 18:10:00 +02:00
parent 01769e1490
commit 317d250476
3 changed files with 2 additions and 13 deletions

View file

@ -23,7 +23,7 @@ object ForumPost extends LilaController with forum.Controller {
case (categ, topic, posts) forms.post.bindFromRequest.fold(
err BadRequest(html.forum.topic.show(
categ, topic, posts, Some(err -> forms.captchaCreate))),
data UAFirewall {
data Firewall {
val post = postApi.makePost(categ, topic, data).unsafePerformIO
Redirect("%s#%d".format(
routes.ForumTopic.show(

View file

@ -26,7 +26,7 @@ object ForumTopic extends LilaController with forum.Controller {
IOptionResult(categRepo bySlug categSlug) { categ
forms.topic.bindFromRequest.fold(
err BadRequest(html.forum.topic.form(categ, err, forms.captchaCreate)),
data UAFirewall {
data Firewall {
val topic = topicApi.makeTopic(categ, data).unsafePerformIO
Redirect(routes.ForumTopic.show(categ.slug, topic.slug, 1))
}

View file

@ -74,17 +74,6 @@ trait LilaController
}
)
def UAFirewall[A <: Result](a: A)(implicit ctx: Context): Result = Firewall {
val uas = List(
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1",
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1")
val ua = ctx.req.headers.get("User-Agent").|("?")
if (ctx.isAnon && uas.contains(ua.pp)) {
println("blocked " + ua)
Redirect(routes.Lobby.home())
} else a
}
def JsonOk(map: Map[String, Any]) = Ok(toJson(map)) as JSON
def JsonOk(list: List[Any]) = Ok(Json generate list) as JSON