Separate pages for active and inactive accounts

tags/smeserver-expire-accounts-0.1.7-1
Daniel Berteaud 9 years ago
parent b0c534cbfb
commit 37ffff48c5
  1. 16
      root/etc/e-smith/locale/en/etc/e-smith/web/functions/expireaccounts
  2. 16
      root/etc/e-smith/locale/fr/etc/e-smith/web/functions/expireaccounts
  3. 23
      root/etc/e-smith/web/functions/expireaccounts
  4. 17
      root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/expireaccounts.pm

@ -52,10 +52,6 @@
<trans>Notify users</trans> <trans>Notify users</trans>
</entry> </entry>
<entry> <entry>
<base>DESC_MODIFY_USER_PAGE</base>
<trans>You can set the expiration of user account.</trans>
</entry>
<entry>
<base>DESC_LOCK_ON_DATE</base> <base>DESC_LOCK_ON_DATE</base>
<trans>Specify the date on which the account will automatically be locked. The date must be in YYYY-MM-DD format, eg 2018-07-25 for July the 25th 2018. Keep this field blank to disable account expiration.</trans> <trans>Specify the date on which the account will automatically be locked. The date must be in YYYY-MM-DD format, eg 2018-07-25 for July the 25th 2018. Keep this field blank to disable account expiration.</trans>
</entry> </entry>
@ -120,18 +116,6 @@
<trans>Days left until deletion</trans> <trans>Days left until deletion</trans>
</entry> </entry>
<entry> <entry>
<base>USER_NOT_FOUND</base>
<trans>The account couldn't be found in the database</trans>
</entry>
<entry>
<base>ERROR_OCCURRED</base>
<trans>An error occurred</trans>
</entry>
<entry>
<base>USER_LOCKED</base>
<trans>This account is already locked</trans>
</entry>
<entry>
<base>TAINTED_USER</base> <base>TAINTED_USER</base>
<trans>Invalid characters in the account name</trans> <trans>Invalid characters in the account name</trans>
</entry> </entry>

@ -52,10 +52,6 @@
<trans>Notifier les utilisateurs</trans> <trans>Notifier les utilisateurs</trans>
</entry> </entry>
<entry> <entry>
<base>DESC_MODIFY_USER_PAGE</base>
<trans>Vous pouvez configurer l'expiration du compte utilisateur.</trans>
</entry>
<entry>
<base>DESC_LOCK_ON_DATE</base> <base>DESC_LOCK_ON_DATE</base>
<trans>Précisez ici la date à laquelle le compte sera automatiquement verrouillé. La date doit être au format AAAA-MM-JJ, par exemple 2018-07-25 pour le 25 Juillet 2018. Laissez ce champs vide pour désactiver l'expiration du compte.</trans> <trans>Précisez ici la date à laquelle le compte sera automatiquement verrouillé. La date doit être au format AAAA-MM-JJ, par exemple 2018-07-25 pour le 25 Juillet 2018. Laissez ce champs vide pour désactiver l'expiration du compte.</trans>
</entry> </entry>
@ -120,18 +116,6 @@
<trans>Jours restants avant suppression</trans> <trans>Jours restants avant suppression</trans>
</entry> </entry>
<entry> <entry>
<base>USER_NOT_FOUND</base>
<trans>Le compte n'a pas été trouvé dans la base</trans>
</entry>
<entry>
<base>ERROR_OCCURRED</base>
<trans>Une erreur est survenue</trans>
</entry>
<entry>
<base>USER_LOCKED</base>
<trans>Ce compte utilisateur est déjà verrouillé</trans>
</entry>
<entry>
<base>TAINTED_USER</base> <base>TAINTED_USER</base>
<trans>Caractères invalides dans le nom du compte</trans> <trans>Caractères invalides dans le nom du compte</trans>
</entry> </entry>

@ -3,7 +3,7 @@
# vim: ft=xml ts=4 sw=4 et: # vim: ft=xml ts=4 sw=4 et:
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# heading : Collaboration # heading : Collaboration
# description : User Informations # description : Accounts Expiration
# navigation : 2000 2100 # navigation : 2000 2100
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -29,7 +29,6 @@
#---------------------------------------------------------------------- #----------------------------------------------------------------------
use strict; use strict;
use esmith::TestUtils;
use esmith::FormMagick::Panel::expireaccounts; use esmith::FormMagick::Panel::expireaccounts;
my $fm = esmith::FormMagick::Panel::expireaccounts->new(); my $fm = esmith::FormMagick::Panel::expireaccounts->new();
@ -64,13 +63,21 @@ __DATA__
</field> </field>
<subroutine src="print_save_button()" /> <subroutine src="print_save_button()" />
</page> </page>
<page name="Modify" pre-event="turn_off_buttons()" post-event="modify_user()"> <page name="ModifyLocked" pre-event="turn_off_buttons()" post-event="modify_user()">
<description>DESC_MODIFY_USER_PAGE</description> <field type="select" id="ExpireAutoReply" value="get_user_bool('ExpireAutoReply')" options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'">
<field <description>DESC_AUTO_REPLY</description>
type="literal" <label>LABEL_AUTO_REPLY</label>
id="UserLockedWarning" </field>
value="print_user_locked_warning()"> <field type="select"
id="ExpireDeleteAfterLock"
value="get_user_prop('ExpireDeleteAfterLock')"
options="'never', '7', '30', '180', '365'">
<description>DESC_DELETE_AFTER_LOCK</description>
<label>LABEL_DELETE_AFTER_LOCK</label>
</field> </field>
<subroutine src="print_save_button()" />
</page>
<page name="ModifyActive" pre-event="turn_off_buttons()" post-event="modify_user()">
<field type="text" size="30" id="ExpireLockOn" validation="is_future_date_or_empty" value="get_user_prop('ExpireLockOn')"> <field type="text" size="30" id="ExpireLockOn" validation="is_future_date_or_empty" value="get_user_prop('ExpireLockOn')">
<description>DESC_LOCK_ON_DATE</description> <description>DESC_LOCK_ON_DATE</description>
<label>LABEL_LOCK_ON_DATE</label> <label>LABEL_LOCK_ON_DATE</label>

@ -38,7 +38,6 @@ our @EXPORT = qw(
print_save_button print_save_button
print_custom_button print_custom_button
print_section_bar print_section_bar
print_user_locked_warning
); );
our $a = esmith::AccountsDB->open || die "Couldn't open AccountsDB"; our $a = esmith::AccountsDB->open || die "Couldn't open AccountsDB";
@ -89,7 +88,7 @@ sub print_user_table {
my $lock_date = $u->prop('ExpireLockOn') || ''; my $lock_date = $u->prop('ExpireLockOn') || '';
my $delivery = $u->prop('EmailForward') || 'local'; my $delivery = $u->prop('EmailForward') || 'local';
my $fwd = $u->prop('ForwardAddress') || ''; my $fwd = $u->prop('ForwardAddress') || '';
my $action = "<a href=\"$scriptname?page=0&page_stack=&acctName=$username&wherenext=Modify\">" . my $action = "<a href=\"$scriptname?page=0&page_stack=&acctName=$username&wherenext=ModifyActive\">" .
$self->localise('MODIFY') . "</a>"; $self->localise('MODIFY') . "</a>";
my $days_left = ''; my $days_left = '';
if ($lock_date =~ m/^(\d{4})\-(\d{1,2})\-(\d{1,2})$/){ if ($lock_date =~ m/^(\d{4})\-(\d{1,2})\-(\d{1,2})$/){
@ -131,7 +130,7 @@ sub print_user_table {
my $locked_on = $u->prop('ExpireLockedOn') || ''; my $locked_on = $u->prop('ExpireLockedOn') || '';
my $delivery = $u->prop('EmailForward') || ''; my $delivery = $u->prop('EmailForward') || '';
my $fwd = $u->prop('ForwardAddress') || ''; my $fwd = $u->prop('ForwardAddress') || '';
my $action = "<a href=\"$scriptname?page=0&page_stack=&acctName=$username&wherenext=Modify\">" . my $action = "<a href=\"$scriptname?page=0&page_stack=&acctName=$username&wherenext=ModifyLocked\">" .
$self->localise('MODIFY') . "</a>"; $self->localise('MODIFY') . "</a>";
my $days_left = ''; my $days_left = '';
if ($delete_in =~ m/^\d+$/ && $locked_on =~ m/^(\d{4})\-(\d{1,2})\-(\d{1,2})$/){ if ($delete_in =~ m/^\d+$/ && $locked_on =~ m/^(\d{4})\-(\d{1,2})\-(\d{1,2})$/){
@ -163,18 +162,6 @@ sub print_user_table {
return ""; return "";
} }
sub print_user_locked_warning {
my ($self) = @_;
my $u = $self->{cgi}->param('acctName');
my $user = $a->get($u);
return $self->localise('USER_NOT_FOUND') unless ($user);
my $type = $user->prop('type');
return $self->localise('ERROR_OCCURRED') unless ($type && $type eq 'user');
my $pass = $user->prop('PasswordSet') || 'no';
return $self->localise('USER_LOCKED') if ($pass eq 'no');
return "";
}
sub print_save_button { sub print_save_button {
my ($self) = @_; my ($self) = @_;
$self->print_button("SAVE"); $self->print_button("SAVE");

Loading…
Cancel
Save