diff --git a/conf/vroom.conf.sample b/conf/vroom.conf.sample index ae52b47..ba7f5a4 100644 --- a/conf/vroom.conf.sample +++ b/conf/vroom.conf.sample @@ -27,6 +27,13 @@ inactivityTimeout => 3600, # 0 means they are not deleted. You can use a high number # so that persistent rooms are kept long enough, but deleted when not used persistentInactivityTimeout => 0, +# A list of room names which are valid but too common to allow reservation +# with an owner password +commonRoomNames => [ + 'test', 'test1', 'test123', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + '123', '1234', '12345', 'a', 'aa', 'abc', 'azerty', 'qwerty', 'vroom', + 'foo', 'bar', 'baz' +], logLevel => 'info', # ID of the Chrome extension for screen sharing diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 28a966b..f7fc6ae 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -81,6 +81,7 @@ our %Lexicon = ( "REMOVE_PASSWORD" => "Remove the password", "PASSWORD_SET" => "Password updated", "PASSWORD_REMOVED" => "Password removed", + "ERROR_COMMON_ROOM_NAME" => "Sorry, this room name is too comon to be reserved", "AUTHENTICATE" => "Authentication", "AUTH_TO_MANAGE_THE_ROOM" => "Authenticate to manage the room", "OWNER_PASSWORD_MAKES_PERSISTENT" => "You can set a manager password. It will make this room persistent", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 3f8a7e1..f607fdf 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -88,6 +88,7 @@ our %Lexicon = ( "REMOVE_PASSWORD" => "Supprimer le mot de passe", "PASSWORD_SET" => "Le mot de passe a été mis à jour", "PASSWORD_REMOVED" => "Le mot de passe a été supprimé", + "ERROR_COMMON_ROOM_NAME" => "Désolé, le nom de ce salon est trop commun pour être réservé", "AUTHENTICATE" => "Authentification", "AUTH_TO_MANAGE_THE_ROOM" => "Authentifiez-vous pour gérer le salon", "OWNER_PASSWORD_MAKES_PERSISTENT" => "Ajouter un mot de passe de gestionnaire. Ceci rendra le salon persistant", diff --git a/public/vroom.pl b/public/vroom.pl index a83cef8..3d3457e 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -113,6 +113,7 @@ our $config = plugin Config => { template => 'default', inactivityTimeout => 3600, persistentInactivityTimeout => 0, + commonRoomNames => [ qw() ], logLevel => 'info', chromeExtensionId => 'ecicdpoejfllflombfanbhfpgcimjddn', sendmail => '/sbin/sendmail' @@ -783,7 +784,13 @@ post '/action' => sub { # Once again, only the owner can do this if ($self->session($room)->{role} eq 'owner'){ if ($type eq 'owner'){ - $res = $self->set_owner_pass($room,$pass); + # Forbid a few common room names to be reserved + if (grep { $room eq $_ } @{$config->{commonRoomNames}}){ + $msg = 'ERROR_COMMON_ROOM_NAME'; + } + else{ + $res = $self->set_owner_pass($room,$pass); + } } else{ $res = $self->set_join_pass($room,$pass);