Sure.  Here is a subroutine from a web page that I made that changes a
user's password using ARSPerl in a cgi script.  Basically ars_SetEntry
can take the password as a parameter and it will encrypt it once it's in
the database.  

sub changeit {
        if ($newpwd ne $cnewpwd) {
                print "<span class='greet'>";
                print "<h2>Passwords did not match. Try
again.<br></h2>";
                print "<a href=",$ENV{SCRIPT_NAME},">Click here to
retry</a>";
                print "</span>\n";
                exit;
        }
        print "Changing password on $server...<br>\n";

        my $userSchema = 'User';
        (%uf = ars_GetFieldTable($ctrl, $userSchema)) ||
&errorHandler($ars_errstr);

        $q=sprintf "'%d' = \"%s\"", $uf{"Login Name"}, $loginname;
        (my $qual = ars_LoadQualifier($ctrl,$userSchema,$q)) or
&errorHandler("error in ars_LoadQualifier: $ars_errstr");
        
        (%userList = ars_GetListEntry($ctrl,$userSchema, $qual, 0, 0))
|| &errorHandler("User lookup died: $ars_errstr");
        #(%userList = ars_GetListEntry($ctrl,$userSchema, $qual, 0)) ||
&errorHandler("User lookup died: $ars_errstr");

        my $count=keys %userList;
        if ($count != 1) {
                print "<span class='greet'>";
                print "Major problem in Remedy. Duplicate User Name.
Contact the helpdesk.\n";
                print "</span>\n";
                return 1;
        } else {
                while (my($entry_id, $desc) = each %userList) {
                        (%user =
ars_GetEntry($ctrl,$userSchema,$entry_id)) 
                                or &errorHandler("** ERROR retrieving
user information: $ars_errstr\n");
                        (my $rtnCode = ars_SetEntry($ctrl, $userSchema,
$entry_id, 0,
                                $uf{"Password"}, $newpwd)) or 
                                        die "Could not update user
password for $fullname due to $ars_errstr\n";
                }
        }
        print "<h2>Password changed</h2>\n";

}

Tim Pittman
Project Engineer
Respironics, Inc.
 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeff Murphy
Sent: Tuesday, July 31, 2007 2:42 PM
To: ARSperl User Discussion
Subject: Re: [Arsperl-users] Can you change the remedy user's password
in ARSperl?

Van De Kerk, David - PHX wrote:
> 
> 
> Hi,
> 
> I am very new to ARSperl.
> 
> Is it possible to change the password of the user you log in with?
> 


I've never tried it via Perl, but you should be able to change the
password by setting the appropriate record/field in the User form.

jeff

------------------------------------------------------------------------
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Arsperl-users mailing list
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Arsperl-users mailing list
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

Reply via email to