3
3
# otrs.setPassword - Changes or Sets password for a user
4
# Copyright (C) 2002 Atif Ghaffar <aghaffar@developer.ch>
5
# $Id: otrs.setPassword,v 1.7 2003/01/23 22:50:09 martin Exp $
6
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
7
# the enclosed file COPYING for license information (GPL). If you
8
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
4
# Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
6
# $Id: otrs.setPassword,v 1.9 2006/08/26 17:22:05 martin Exp $
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
# use ../ as lib location
11
24
use File::Basename;
12
25
use FindBin qw($RealBin);
13
26
use lib dirname($RealBin);
14
27
use lib dirname($RealBin)."/Kernel/cpan-lib";
17
print "$FindBin::Script username password";
23
31
use Kernel::Config;
24
32
use Kernel::System::Log;
25
33
use Kernel::System::DB;
26
34
use Kernel::System::User;
29
# create common objects
36
my $VERSION = '$Revision: 1.9 $';
37
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
42
print "otrs.setPassword <Revision $VERSION> - set a new agent password\n";
43
print "Copyright (c) 2001-2006 OTRS GmbH, http://otrs.org/\n";
44
print "usage: otrs.setPassword user password\n";
48
# create common objects
31
49
my %CommonObject = ();
32
50
$CommonObject{ConfigObject} = Kernel::Config->new(%CommonObject);
33
$CommonObject{LogObject} = Kernel::System::Log->new(%CommonObject, LogPrefix => 'otrs.setPassword');
51
$CommonObject{LogObject} = Kernel::System::Log->new(
53
LogPrefix => 'otrs.setPassword',
34
55
$CommonObject{DBObject} = Kernel::System::DB->new(%CommonObject);
35
56
$CommonObject{UserObject} = Kernel::System::User->new(%CommonObject);
62
print STDERR "ERROR: need user ARG[1]\n";
66
print STDERR "ERROR: need password ARG[1]\n";
42
70
# user id of the person Changing the record
45
$Param{UserLogin}=$ARGV[0];
49
$CommonObject{UserObject}->SetPassword(%Param);
71
$CommonObject{UserObject}->SetPassword(