add unset/password command to delete a user password
authorminima <minima>
Thu, 25 Oct 2001 13:51:34 +0000 (13:51 +0000)
committerminima <minima>
Thu, 25 Oct 2001 13:51:34 +0000 (13:51 +0000)
Changes
cmd/Commands_en.hlp
cmd/unset/password.pl [new file with mode: 0644]
perl/DXUser.pm
perl/Messages

diff --git a/Changes b/Changes
index e7df720fad6ec979e4f2baf946962f51ed28d274..01ce2a564972f3da1f5c4db8af1b41cbe5c8246e 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+25Oct01=======================================================================
+1. added unset/password command to allow sysops (only) to completely delete
+and remove a user's password.
 24Oct01=======================================================================
 1. added (un)set/register, show/registered commands which when a 'set/var
 $main::reqreg = 1' is done in the startup script will require users to 
index f84d19e85f1388585a42b369ad383436fe9a04c6..09c69df3fe17889de282443e2aefd635c0bf8926 100644 (file)
@@ -1374,6 +1374,10 @@ is set or the:
 command is executed in the startup script, then a password prompt is
 given after the normal 'login: ' prompt.  
 
+=== 9^UNSET/PASSWORD <call> ...^Delete (remove) a user's password
+This command allows the sysop to completely delete and remove a 
+password for a user. 
+
 === 5^SET/SPIDER <call> [<call>..]^Make the callsign an DXSpider node
 Tell the system that the call(s) are to be treated as DXSpider node and
 fed new style DX Protocol rather normal user commands.
diff --git a/cmd/unset/password.pl b/cmd/unset/password.pl
new file mode 100644 (file)
index 0000000..6fdc925
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# unset a user's password
+#
+# Copyright (c) 2001 Dirk Koopman G1TLH
+#
+# Syntax:      unset/pass <callsign> ... 
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, $line;
+my @out;
+my $user;
+my $ref;
+
+if ($self->remotecmd) {
+       Log('DXCommand', $self->call . " attempted to unset password for @args remotely");
+       return (1, $self->msg('e5'));
+}
+
+if ($self->priv < 9) {
+       Log('DXCommand', $self->call . " attempted to unset password for @args");
+       return (1, $self->msg('e5'));
+}
+
+for (@args) {
+       my $call = uc $_;
+       if ($ref = DXUser->get_current($call)) {
+               $ref->unset_passwd;
+               $ref->put();
+               push @out, $self->msg("passwordu", $call);
+               Log('DXCommand', $self->call . " unset password for $call");
+       } else {
+               push @out, $self->msg('e3', 'User record for', $call);
+       }
+}
+
+return (1, @out);
index f16494f91c9361c41813878ed9705d0aff533bbb..c9725f271e5b804cb6581e02a859e8e2e335fbae 100644 (file)
@@ -580,6 +580,12 @@ sub is_ak1a
        my $self = shift;
        return $self->{sort} eq 'A';
 }
+
+sub unset_passwd
+{
+       my $self = shift;
+       delete $self->{passwd};
+}
 1;
 __END__
 
index bc1f8df5c2b5984bb9ccc1854c531243fa8c2b83..815d09fc1d316f372fbead1fe792ecf5cf85cd17 100644 (file)
@@ -194,6 +194,7 @@ package DXM;
                                pagelth => 'Page Length is now $_[0]',
                                passerr => 'Please use: SET/PASS <password> <callsign>',
                                password => 'Password set or changed for $_[0]',
+                               passwordu => 'Password removed for $_[0]',
                                pingo => 'Ping Started to $_[0]',
                                pingi => 'Ping Returned from $_[0] $_[1] (Ave $_[2]) secs',
                                pinge1 => 'Cannot ping yourself!',