Commit Diff
Diff:
1fa47b0a3fb52258ba2004152c826c448ed30774
4bac7b57a63792f593f308d20a1ffe050f41e45a
Commit:
4bac7b57a63792f593f308d20a1ffe050f41e45a
Tree:
8d8363f47c8381c5900ae968693e8cdc73d1fabc
Author:
jrmu <jrmu@ircnow.org>
Committer:
jrmu <jrmu@ircnow.org>
Date:
Fri Jun 30 00:04:58 2023 UTC
Message:
Fixes handling of emails/approvals -- thanks to gry's suggested patch, with minor modifications
blob - 0d92083cf401c6a07eec9fad1084e4dfeff51f7f
blob + b5156896312b287db974aecd9bcbae60f58b6ea0
--- BNC.pm
+++ BNC.pm
@@ -123,7 +123,11 @@ sub mbnc {
} elsif (main::isstaff($bot, $nick) && $text =~ /^approve\s+([[:ascii:]]+)/) {
my $username = $1;
if (SQLite::selectrows("bnc", "username", $username)) {
- main::putserv($bot, "PRIVMSG *blockuser :unblock $username");
+ my $email = SQLite::get("bnc", "username", $username, "email");
+ my $password = Hash::newpass();
+ main::putserv($bot,"privmsg *controlpanel :set Password $username $password");
+ main::putserv($bot, "PRIVMSG *blockuser :unblock $username");
+ mailbncApproved($username,$email,$password);
foreach my $chan (@teamchans) {
main::putserv($bot, "PRIVMSG $chan :$username bnc approved");
}
@@ -165,14 +169,16 @@ sub mbnc {
if (DNS::nextdns($username)) {
sleep(2);
createbnc($bot, $username, $pass, $bindhost);
- main::putserv($bot, "PRIVMSG $nick :Check your email!");
- mailbnc($username, $email, $pass, "bouncer", $hashirc);
if ($approval eq "true") {
main::putserv($bot, "PRIVMSG *blockuser :block $username");
- main::putserv($bot, "PRIVMSG $nick :Your account has been created but must be manually approved by your admins ($staff) before it can be used.");
+ main::putserv($bot, "PRIVMSG $nick :Your account has been created but must be approved by your admins ($staff) before it can be used. Please reply to the email and contact staff over IRC.");
+ mailbncPending($username, $email);
foreach my $chan (@teamchans) {
- main::putservlocalnet($bot, "PRIVMSG $chan :$staff: $nick\'s account $username must be manually unblocked before it can be used.");
+ main::putservlocalnet($bot, "PRIVMSG $chan :$staff: To approve $nick, you must type !bnc approve $username");
}
+ } else {
+ main::putserv($bot, "PRIVMSG $nick :Check your email! Please reply to the email and contact staff over IRC.");
+ mailbncApproved($username,$email,$pass);
}
foreach my $chan (@teamchans) {
main::putservlocalnet($bot, "PRIVMSG $chan :$staff: $nick\'s bnc registration of $username on $bot->{name} was successful, *but* you *must* help him connect. Most users are unable to connect. Show him https://wiki.ircnow.org/?n=Bouncer.Bouncer and give him connection instructions");
@@ -407,23 +413,11 @@ EOF
main::putserv($bot, "PRIVMSG *controlpanel :$msg");
return 1;
}
-sub mailbnc {
- my( $username, $email, $password, $service, $hashirc )=@_;
- my $passhash = sha256_hex("$username");
- my $approvemsg;
- if ($approval eq "true") {
- $approvemsg = <<"EOF";
+sub mailbncApproved {
+ my( $username, $email, $password)=@_;
+ my $body = <<"EOF";
+Welcome to $conf{localnet}!
-*IMPORTANT*: Your account has been created but it has not yet been
-approved. To get your account approved, please contact your admins
-$staff on IRC and by email.
-
-EOF
- }
-
-my $body = <<"EOF";
-Welcome to IRCNow!
-
You created a bouncer:
Username: $username
@@ -432,19 +426,36 @@ Server: $bnchostname
Port: $sslport for SSL (secure connection)
Port: $plainport for plaintext
Webpanel: $webpanel
-$approvemsg
-*IMPORTANT*: Verify your email address:
-Please reply to this email to indicate you have received the email. You must
-reply in order to keep your account.
+Connection Instructions: https://wiki.ircnow.org/?n=Bouncer.Bouncer
-IRCNow
+Enjoy!
+
+$conf{localnet}
+IRCNow Federation
EOF
- main::mail($mailfrom, $email, $mailname, "Verify IRCNow Account", $body);
+ main::mail($mailfrom, $email, $mailname, "Your $conf{localnet} Bouncer", $body);
}
+sub mailbncPending {
+ my( $username, $email)=@_;
+ my $body = <<"EOF";
+Welcome to $conf{localnet}!
+
+Your bouncer needs to be approved by staff ($staff).
+Please reply to this email and contact them over IRC.
+
+Once $staff have been contacted, they will send you login
+instructions. This may take up to 48 hours.
+
+$conf{localnet}
+IRCNow Federation
+EOF
+ main::mail($mailfrom, $email, $mailname, "Confirm $conf{localnet} Bouncer", $body);
+}
+
sub mtaillog {
- my ($bot, $nick, $host, $hand, @args) = @_;
+ my ($bot, $nick, $host, $hand, @args) = @_;
my ($chan, $text);
if (@args == 2) {
($chan, $text) = ($args[0], $args[1]);
IRCNow