From 37ef2240f972a18df8fbd456da22fc10f3bc6af1 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 30 May 2014 13:07:12 +0200 Subject: [PATCH] Update msg when seting passwords (join or owner) --- lib/Vroom/I18N/en.pm | 6 ++++-- lib/Vroom/I18N/fr.pm | 6 ++++-- public/vroom.pl | 12 +++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 466c5ef..06b204e 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -95,8 +95,10 @@ our %Lexicon = ( "YOU_CAN_PASSWORD_PROTECT_JOIN" => "You can protect this room with a password", "PASSWORD" => "Password", "PASSWORD_PROTECT" => "Password protect", - "PASSWORD_SET" => "Password set", - "PASSWORD_REMOVED" => "Password removed", + "PASSWORD_PROTECT_SET" => "A password will be needed to join this room", + "PASSWORD_PROTECT_UNSET" => "No password will be asked to join this room", + "ROOM_NOW_PERSISTENT" => "This room is now persistent", + "ROOM_NO_MORE_PERSISTENT" => "This room isn't persistent anymore", "PASSWORDS_DO_NOT_MATCH" => "Passwords do not match", "MAKE_THIS_ROOM_PERSISTENT" => "Make this room persistent", "SET_OWNER_PASS_PERSISTENT" => "To make this room persistent, you must set a manager password. Keep it carefully, " . diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index a808c0b..de95349 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -102,8 +102,10 @@ our %Lexicon = ( "YOU_CAN_PASSWORD_PROTECT_JOIN" => "Protéger l'accès au salon par un mot de passe", "PASSWORD" => "Mot de passe", "PASSWORD_PROTECT" => "Protéger par mot de passe", - "PASSWORD_SET" => "Le mot de passe a été pris en compte", - "PASSWORD_REMOVED" => "Le mot de passe a été supprimé", + "PASSWORD_PROTECT_SET" => "Un mot de passe sera demandé pour rejoindre ce salon", + "PASSWORD_PROTECT_UNSET" => "Aucun mot de passe ne sera demandé pour rejoindre ce salon", + "ROOM_NOW_PERSISTENT" => "Ce salon est maintenant persistant", + "ROOM_NO_MORE_PERSISTENT" => "Ce salon n'est plus persistant", "PASSWORDS_DO_NOT_MATCH" => "Les mots de passe ne correspondent pas", "MAKE_THIS_ROOM_PERSISTENT" => "Rendre ce salon persistant", "SET_OWNER_PASS_PERSISTENT" => "Pour rendre ce salon persistant, vous devez saisir un mot de passe " . diff --git a/public/vroom.pl b/public/vroom.pl index 7b41e2f..c11a053 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -935,15 +935,13 @@ post '/action' => sub { if (grep { $room eq $_ } @{$config->{commonRoomNames}}){ $msg = $self->l('ERROR_COMMON_ROOM_NAME'); } - else{ - $res = $self->set_owner_pass($room,$pass); + elsif ($self->set_owner_pass($room,$pass)){ + $msg = ($pass) ? $self->l('ROOM_NOW_PERSISTENT') : $self->l('ROOM_NO_MORE_PERSISTENT'); + $status = 'success'; } } - else{ - $res = $self->set_join_pass($room,$pass); - } - if ($res){ - $msg = ($pass) ? $self->l('PASSWORD_SET') : $self->l('PASSWORD_REMOVED'); + elsif ($type eq 'join' && $self->set_join_pass($room,$pass)){ + $msg = ($pass) ? $self->l('PASSWORD_PROTECT_SET') : $self->l('PASSWORD_PROTECT_UNSET'); $status = 'success'; } }