From 0ee132334fb7cd61fa159a066749d62195065ef9 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 9 May 2014 13:37:36 +0200 Subject: [PATCH] Prevent room name using reserved word --- public/vroom.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/vroom.pl b/public/vroom.pl index 5f29684..3a7e73c 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -205,13 +205,14 @@ helper ping_room => sub { }; # Check if this name is a valid room name -# TODO: reject if the name is the same as an existing route helper valid_room_name => sub { my $self = shift; my ($name) = @_; my $ret = undef; my $len = length $name; - if ($len > 0 && $len < 50 && $name =~ m/^[\w\-]+$/){ + # A few names are reserved + my @reserved = qw(about help feedback goodbye admin create localize action missing dies); + if ($len > 0 && $len < 50 && $name =~ m/^[\w\-]+$/ && !grep { $name eq $_ } @reserved){ $ret = 1; } return $ret;