Commit Diff
Diff:
75f89aebc6f10975810bfb93fa1eba7018fa61fd
0744bd0b8629c5e120a268c37b6930b0a10f485b
Commit:
0744bd0b8629c5e120a268c37b6930b0a10f485b
Tree:
a737edfc45e38a06e2e5a73846b75e2f741285ed
Author:
jrmu <jrmu@ircnow.org>
Committer:
jrmu <jrmu@ircnow.org>
Date:
Sat May 6 06:31:06 2023 UTC
Message:
Properly disable accounts using usermod -Z instead of expiring them, patch thanks to IanJ
blob - 6a70c755f48a5bcce71ba13feeba1d7363930fa5
blob + 4a204786533077e78963583e6aa94f1f7929590d
--- Shell.pm
+++ Shell.pm
@@ -43,13 +43,6 @@ use constant {
main::cbind("pub", "-", "shell", \&mshell);
main::cbind("msg", "-", "shell", \&mshell);
-# Returns yesterday's date in mmmDDYYYY format
-sub yesterday {
- my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
- my $localtime = sprintf("%s%02d%04d", $months[$mon], $mday-1, $year+1900);
- return $localtime;
-}
sub init {
#dependencies for figlet
unveil("/usr/local/bin/figlet", "rx") or die "Unable to unveil $!";
@@ -106,7 +99,7 @@ sub mshell {
return;
} elsif (main::isstaff($bot, $nick) && $text =~ /^approve\s+([[:ascii:]]+)/) {
my $username = $1;
- system "doas usermod -e 0 -s /bin/ksh $username";
+ system "doas usermod -U $username";
foreach my $chan (@teamchans) {
main::putserv($bot, "PRIVMSG $chan :$username approved");
}
@@ -145,8 +138,7 @@ sub mshell {
mailshell($username, $email, $pass, "shell", $version);
main::putserv($bot, "PRIVMSG $nick :Check your email!");
if ($approval eq "true") {
- my $yesterday = yesterday();
- system "doas usermod -e $yesterday -s /sbin/nologin $username";
+ system "doas usermod -Z $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.");
foreach my $chan (@teamchans) {
main::putservlocalnet($bot, "PRIVMSG $chan :$staff: $nick\'s account $username must be manually unblocked before it can be used.");
IRCNow