secure resign endpoint

This commit is contained in:
Thibault Duplessis 2016-11-05 12:00:17 +01:00
parent 90a593e0a1
commit a75bdf44a4

View file

@ -272,10 +272,16 @@ object Round extends LilaController with TheftPrevention {
def resign(fullId: String) = Open { implicit ctx =>
OptionFuRedirect(GameRepo pov fullId) { pov =>
env resign pov
import scala.concurrent.duration._
val scheduler = lila.common.PlayApp.system.scheduler
akka.pattern.after(500 millis, scheduler)(fuccess(routes.Lobby.home))
if (isTheft(pov)) {
controllerLogger.warn(s"theft resign $fullId ${HTTPRequest.lastRemoteAddress(ctx.req)}")
fuccess(routes.Lobby.home)
}
else {
env resign pov
import scala.concurrent.duration._
val scheduler = lila.common.PlayApp.system.scheduler
akka.pattern.after(500 millis, scheduler)(fuccess(routes.Lobby.home))
}
}
}