diff options
author | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-04-18 03:23:44 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-04-18 03:23:44 +0200 |
commit | c7cc448801f8b6f10cdd0d86568180687173f03e (patch) | |
tree | 62e9d79300f53d85681d653b043f9401d480432d /fripost-adduser | |
parent | bba3f61c1403d09ad2d38a0fab153f87877a1722 (diff) |
wibble
Diffstat (limited to 'fripost-adduser')
-rwxr-xr-x | fripost-adduser | 13 |
1 files changed, 6 insertions, 7 deletions
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. '>', |