]> gb7djk.dxcluster.net Git - spider.git/blob - cmd/set/passphrase.pl
really fix cc cluster recognition
[spider.git] / cmd / set / passphrase.pl
1 #
2 # set a user's passphrase
3 #
4 # Copyright (c) 2002 Dirk Koopman G1TLH
5 #
6 # Syntax:       set/passphrase <callsign> <password> 
7 #
8
9 my ($self, $line) = @_;
10 my @args = split /\s+/, $line, 2;
11 my $call = shift @args;
12 my @out;
13 my $user;
14 my $ref;
15
16 if ($self->remotecmd || $self->inscript) {
17         $call ||= $self->call;
18         Log('DXCommand', $self->call . " attempted to change passphrase for $call remotely");
19         return (1, $self->msg('e5'));
20 }
21
22 if ($call) {
23         if ($self->priv < 9) {
24                 Log('DXCommand', $self->call . " attempted to change passphrase for $call");
25                 return (1, $self->msg('e5'));
26         }
27         return (1, $self->msg('e29')) unless @args;
28         if ($ref = DXUser::get_current($call)) {
29                 $ref->passphrase($args[0]);
30                 $ref->put();
31                 push @out, $self->msg("passphrase", $call);
32                 Log('DXCommand', $self->call . " changed passphrase for $call");
33         } else {
34                 push @out, $self->msg('e3', 'User record for', $call);
35         }
36 }
37
38 return (1, @out);