Thread: [Arsperl-users] Can you change the remedy user's password in ARSperl?
Brought to you by:
jeffmurphy
|
From: Van De K. D. - P. <DVa...@ch...> - 2007-07-31 18:01:30
|
Hi, I am very new to ARSperl. Is it possible to change the password of the user you log in with? We have a "you must change your password frequently and randomly" mandate. I can't allow the automated interface to be locked out. |
|
From: Jeff M. <jcm...@je...> - 2007-07-31 18:41:33
|
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 |
|
From: Thilo S. <thi...@ap...> - 2007-07-31 19:13:23
|
If it works in the User Tool (which it might or might not do, depending on the field/entry permissions of the "Group" form), it should work via ARSperl as well: ars_SetEntry( $ctrl, $entryId, 0, 102 => 'new_password' ); Regards, Thilo Jeff Murphy wrote: > 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 > Ars...@ar... > https://lists.sourceforge.net/lists/listinfo/arsperl-users > |
|
From: Pittman, T. <Tim...@re...> - 2007-07-31 19:28:37
|
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. =20
sub changeit {
if ($newpwd ne $cnewpwd) {
print "<span class=3D'greet'>";
print "<h2>Passwords did not match. Try
again.<br></h2>";
print "<a href=3D",$ENV{SCRIPT_NAME},">Click here to
retry</a>";
print "</span>\n";
exit;
}
print "Changing password on $server...<br>\n";
my $userSchema =3D 'User';
(%uf =3D ars_GetFieldTable($ctrl, $userSchema)) ||
&errorHandler($ars_errstr);
$q=3Dsprintf "'%d' =3D \"%s\"", $uf{"Login Name"}, $loginname;
(my $qual =3D ars_LoadQualifier($ctrl,$userSchema,$q)) or
&errorHandler("error in ars_LoadQualifier: $ars_errstr");
=09
(%userList =3D ars_GetListEntry($ctrl,$userSchema, $qual, 0, 0))
|| &errorHandler("User lookup died: $ars_errstr");
#(%userList =3D ars_GetListEntry($ctrl,$userSchema, $qual, 0)) ||
&errorHandler("User lookup died: $ars_errstr");
my $count=3Dkeys %userList;
if ($count !=3D 1) {
print "<span class=3D'greet'>";
print "Major problem in Remedy. Duplicate User Name.
Contact the helpdesk.\n";
print "</span>\n";
return 1;
} else {
while (my($entry_id, $desc) =3D each %userList) {
(%user =3D
ars_GetEntry($ctrl,$userSchema,$entry_id))=20
or &errorHandler("** ERROR retrieving
user information: $ars_errstr\n");
(my $rtnCode =3D ars_SetEntry($ctrl, $userSchema,
$entry_id, 0,
$uf{"Password"}, $newpwd)) or=20
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.
=20
-----Original Message-----
From: ars...@ar...
[mailto:ars...@ar...] 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:
>=20
>=20
> Hi,
>=20
> I am very new to ARSperl.
>=20
> Is it possible to change the password of the user you log in with?
>=20
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
Ars...@ar...
https://lists.sourceforge.net/lists/listinfo/arsperl-users
|
|
From: Michiel B. <mic...@gm...> - 2007-07-31 19:05:19
Attachments:
ChangePassword.pl
|
Your password is stored in the User form, you can change it just as any other record in a form. See the attached example. Kind regards, Michiel On 7/31/07, Jeff Murphy <jcm...@je...> wrote: > 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 > Ars...@ar... > https://lists.sourceforge.net/lists/listinfo/arsperl-users > -- Met vriendelijke groet / Kind regards Michiel Beijen ______________________________________________________ MANSOLUTIONS Energieweg 60-62 3771 NA Barneveld The Netherlands Tel. +31-(0)612968592 Mail mic...@ma... Internet http://bsm.mansolutions.nl |
|
From: Michiel B. <mic...@gm...> - 2007-07-31 19:12:12
|
The attachment seems to be blocked (at least for one user, I got a nice message back which I do not understand). Here's the file: #!/usr/bin/perl # # NAME # ChangePassword.pl server username password newpassword # # DESCRIPTION # This script allows a user to change his password. Since user accounts are just # plain records in a form we use the common getlistentry and setentry calls to # fetch the user's record and update the password field. # Note that on some systems permissions are set strangely and depending on # the type of license you have you might not be able to update your password # (Think Read Restricted licenses...) # Also on some systems the User form is renamed to something other than "User". # # AUTHOR # Michiel Beijen, Mansolutions, 2007. # use ARS; use strict; use warnings; die "usage: ChangePassword.pl server username password newpassword\n" unless ( $#ARGV >= 3 ); my ( $server, $user, $password, $newpassword ) = ( shift, shift, shift, shift ); #Logging in to the server ( my $ctrl = ars_Login( $server, $user, $password ) ) || die "ars_Login: $ars_errstr"; # Creating qualifier to look up the entry ID of the username; Login Name field is 101. ( my $userqualifier = ars_LoadQualifier( $ctrl, "User", "'101' = \"$user\"" ) ) || die "ars_LoadQualifier(User): $ars_errstr"; # fetch the Entry ID for this user by using GetListEntry with the qualifier we # just specified, otherwise die. my @userentry = ars_GetListEntry( $ctrl, "User", $userqualifier, 0, 0 ); die "No such user \"$user\"? ($ars_errstr)\n" if ( $#userentry == -1 ); # Change the password for this user by setting field 102 (the password field) with the new value ars_SetEntry( $ctrl, "User", $userentry[0], 0, 102, $newpassword ) || die "Error updating password: $ars_errstr"; print "Password changed for user $user on server $server\n"; |