Prevent owner to be locked out of its own room

If the room was locked when he left
master
Daniel Berteaud 11 years ago
parent 2b461fbc59
commit 76ae8e18ea
  1. 1
      lib/Vroom/I18N/en.pm
  2. 1
      lib/Vroom/I18N/fr.pm
  3. 2
      public/vroom.pl
  4. 2
      templates/default/error.html.ep

@ -84,6 +84,7 @@ our %Lexicon = (
"PASSWORD_REQUIRED" => "Password required",
"A_PASSWORD_IS_NEEDED_TO_JOIN" => "You must provide a password to join this room",
"TRY_AGAIN" => "Try again",
"AUTH_IF_OWNER" => "Authenticate if you are the room owner",
"LOGOUT" => "Leave the room",
"SET_YOUR_NAME_TO_CHAT" => "You need to set your name to be able to chat",
"SEND_MESSAGE" => "Send the message",

@ -90,6 +90,7 @@ our %Lexicon = (
"PASSWORD_REQUIRED" => "Mot de passe requis",
"A_PASSWORD_IS_NEEDED_TO_JOIN" => "Vous devez saisir un mot de passe pour rejoindre ce salon",
"TRY_AGAIN" => "Essayer à nouveau",
"AUTH_IF_OWNER" => "Authentifiez-vous si vous êtes le propriétaire du salon",
"LOGOUT" => "Quitter le salon",
"SET_YOUR_NAME_TO_CHAT" => "Vous devez saisir votre nom avant de pouvoir tchater",
"SEND_MESSAGE" => "Envoyer le message",

@ -426,7 +426,7 @@ get '/(*room)' => sub {
);
}
my @participants = $self->get_participants($room);
if ($data->{'locked'}){
if ($data->{'locked'} && (!$self->session($room) || $self->session($room)->{role} ne 'owner')){
unless (($self->session('name') eq $data->{'owner'}) || (grep { $_ eq $self->session('name') } @participants )){
return $self->render('error',
msg => sprintf($self->l("ERROR_ROOM_s_LOCKED"), $room),

@ -11,6 +11,8 @@
<a class="btn btn-default btn-lg" role="button" href="<%= $self->url_for('/') . $room %>"><%=l 'JOIN_THIS_ROOM' %></a>
<% } elsif ($err eq 'WRONG_PASSWORD'){ %>
<a class="btn btn-default btn-lg" role="button" href="<%= $self->url_for('/password') . '/' . $room %>"><%=l 'TRY_AGAIN' %></a>
<% } elsif ($err eq 'ERROR_ROOM_s_LOCKED'){ %>
<a class="btn btn-default btn-lg" role="button" href="<%= $self->url_for('/password') . '/' . $room %>"><%=l 'AUTH_IF_OWNER' %></a>
<% } %>
</div>
</div>

Loading…
Cancel
Save