Commit Diff
Diff:
c023ac0cb9fddf44779c134dabc0c568674914bb
176d5d5d9a6208946006a89a85fd93a4fafc7919
Commit:
176d5d5d9a6208946006a89a85fd93a4fafc7919
Tree:
083bede25eaae437c23dd73348fa36d1a0e8b16a
Author:
jrmu <jrmu@ircnow.org>
Committer:
jrmu <jrmu@ircnow.org>
Date:
Mon Mar 6 00:48:08 2023 UTC
Message:
Fix senderspath
blob - 9c0569f1a8a5e9525edf63df0cf86f3691a208e4
blob + ea264bb186718e1782b96621a9a983d02252a7ad
--- Mail.pm
+++ Mail.pm
@@ -14,6 +14,15 @@ my $staff = $conf{staff};
my $hostname = $conf{hostname};
my $mailfrom = $conf{mailfrom};
my $mailname = $conf{mailname};
+my $imapport = $conf{imapport};
+my $smtpport = $conf{smtpport};
+my $teamchans = $conf{teamchans};
+my @teamchans = split /[,\s]+/m, $teamchans;
+my $mailwebpanel = $conf{mailwebpanel};
+my $passwdpath = "/etc/mail/passwd";
+my $virtualspath = "/etc/mail/virtuals";
+my $senderspath = "/etc/mail/users";
+
main::cbind("msg", "-", "mail", \&mmail);
sub init {
@@ -178,6 +187,16 @@ return "true";
sub mailmail {
my( $username, $password, $email )=@_;
+ my $approvemsg;
+ if ($approval eq "true") {
+ $approvemsg = <<"EOF";
+
+*IMPORTANT*: Your account has been created but it has not yet been
+activated. To activate your account, please contact your admins
+$staff on IRC and by email.
+
+EOF
+ }
my $body = <<"EOF";
Welcome to IRCNow!
@@ -206,26 +225,33 @@ EOF
sub createmail {
my ($password, $username) = @_;
chomp(my $encrypted = `encrypt $password`);
- my $line = "${username}\@ircnow.org:${encrypted}::::::userdb_quota_rule=*:storage=1G";
+ my $line = "${username}\@$hostname:${encrypted}::::::userdb_quota_rule=*:storage=1G";
$line =~ s{\$}{\\\$}g;
- my $line2 = "${username}\@ircnow.org vmail";
- my $line3 = "${username}: ${username}\@ircnow.org";
- `doas sh -c 'echo $line >> /etc/mail/passwd'`;
- `doas sh -c 'echo $line2 >> /etc/mail/virtuals'`;
+ my $line2 = "${username}\@$hostname vmail";
+ my $line3 = "${username}\@$hostname: ${username}\@$hostname";
+ `doas sh -c 'echo $line >> $passwdpath'`;
+ `doas sh -c 'echo $line2 >> $virtualspath'`;
+ `doas sh -c 'echo $line3 >> $senderspath'`;
`doas rcctl restart smtpd`;
`doas rcctl reload dovecot`;
}
sub deletemail {
my ($username) = @_;
- my @passwd = readarray("/etc/mail/passwd");
- my @virtuals = readarray("/etc/mail/virtuals");
+ my @passwd = readarray($passwdpath);
+ my @virtuals = readarray($virtualspath);
+ my @senders = readarray($senderspath);
@passwd = grep !/^${username}\@${hostname}/, @passwd;
@virtuals = grep !/^${username}\@${hostname}/, @virtuals;
+ @senders = grep !/^${username}\@${hostname}/, @virtuals;
# trailing newline necessary
- main::writefile("$filename.bak", join("\n", @lines)."\n");
- copy "$filename.bak", $filename;
+ main::writefile("$passwdpath.bak", join("\n", @passwd)."\n");
+ copy "$passwdpath.bak", $passwdpath;
+ main::writefile("$virtualspath", join("\n", @virtuals)."\n");
+ copy "$virtualspath.bak", $virtualspath;
+ main::writefile("$senderspath", join("\n", @senders)."\n");
+ copy "$senderspath.bak", $senderspath;
`doas rcctl restart smtpd`;
`doas rcctl reload dovecot`;
IRCNow