Permalink
Browse files

Added some anti-script logic

  • Loading branch information...
1 parent 0a79396 commit 0b98b679cd03cb2edfd3e6fb66514d301f11d74e @dpp dpp committed Jan 21, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/main/scala/net/liftweb/seventhings/snippet/ChatIn.scala
@@ -15,9 +15,15 @@ import js.JE._
* to the ChatServer
*/
object ChatIn {
+ // max count per session
+ private object lineCnt extends SessionVar(0)
+
def render =
"*" #> SHtml.onSubmit(s => {
- ChatServer ! s // send the message
+ if (s.length < 50 && lineCnt < 20) { // 20 lines per session
+ ChatServer ! s // send the message
+ lineCnt.set(lineCnt.is + 1)
+ }
SetValById("chat_in", "") // clear the input box
})
}

0 comments on commit 0b98b67

Please sign in to comment.