From c7cc448801f8b6f10cdd0d86568180687173f03e Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 18 Apr 2012 03:23:44 +0200 Subject: wibble --- fripost-adduser | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'fripost-adduser') diff --git a/fripost-adduser b/fripost-adduser index a3c78a8..f509e49 100755 --- a/fripost-adduser +++ b/fripost-adduser @@ -161,12 +161,11 @@ my ($domain, $login); if (defined $ARGV[0]) { $username = fix_username ($ARGV[0]); Email::Valid->address($username) - or die "Error: `" .$username. "' is not a valid e-mail.\n"; + or die "Error: $username is not a valid e-mail.\n"; } else { $username = prompt_email("New username: ", 'is_user'); } - # TODO: Ensure that the domain is valid. ($login, $domain) = split /\@/, $username, 2; my $maildir = "$domain/$login/Maildir/"; # Trailing slash important my $isActive = 'TRUE'; @@ -197,14 +196,14 @@ my ($domain, $login); { # Ensure that the username doesn't already exist. die "Error: User `" .$user->{username}. "' already exists.\n" - if $ldap->user->search($user->{username})->count; + if $ldap->user->search({ username => $user->{username} })->count; # Ensure that the username doesn't correspond to an existing alias. my $res = $ldap->alias->search({ address => $user->{username} }); if ($res->count) { - print STDERR "Error: Alias `" .$user->{username}. "' already exists. "; + print STDERR "Error: Alias $user->{username} already exists. "; print STDERR "(Targetting to "; - print STDERR (join ', ', map { '`' .$_->{goto}. "'"} ($res->entries)); + print STDERR (join ', ', map { $_->{goto} } ($res->entries)); say STDERR ".)"; exit 1; } @@ -237,8 +236,8 @@ my $tt = Template->new({ INTERPOLATE => 1, }) || die "$Template::ERROR\n"; -my $admin_email = 'admin@fripost.org'; -$admin_email = $conf->{admin_email} if defined $conf->{admin_email}; +my $admin_email = $conf->{admin_email}; +$admin_email //= 'admin@fripost.org'; my $msg = MIME::Lite->new( From => encode('MIME-Q', 'Friposts administratörer') . ' <' .$admin_email. '>', -- cgit v1.2.3