$self->SUPER::SetPassword() returns "0, Nonexistant field?" in User_Overlay.pm

(rt 3.8.1rc5)

I’ve got some custom functionality in a User_Local.pm file, trying to
call the SetPassword method from lib/RT/User_Overlay.pm. This method
always returns (“0”, “Nonexistant field?”) when trying to get results
from a call to the method it’s overriding; the call is around line 893
in User_Overlay.pm, in this block:

my $new = !$self->HasPassword;
$password = $self->_GeneratePassword($password);
my ( $val, $msg ) = $self->SUPER::SetPassword($password);
if ($val) {
return ( 1, $self->loc(“Password set”) ) if $new;
return ( 1, $self->loc(“Password changed”) );
}
else {
return ( $val, $msg );
}

@ISA at this point only contains RT::Record, which doesn’t have an
explicit SetPassword method but is (probably not coincidentally) the
only place in the RT tree where I can find the string “Nonexistant
field?”. Obviously Set* is defined in here, but this level of
indirection is beyond my extremely limited ooperl-fu. Can someone tell
me what field is nonexistant[sic] here, and why, and what I can do to
fix/workaround?

Thanks,
	Ole

/Ole Craig
Security Engineer
Team lead, customer support

ocraig@stillsecure.com
303-381-3802 main support line
303-381-3824 my voicemail
303-381-3880 fax

www.stillsecure.com

(rt 3.8.1rc5)

I’ve got some custom functionality in a User_Local.pm file, trying to
call the SetPassword method from lib/RT/User_Overlay.pm. This method
always returns (“0”, “Nonexistant field?”) when trying to get results
from a call to the method it’s overriding; the call is around line 893
in User_Overlay.pm, in this block:

my $new = !$self->HasPassword;
$password = $self->_GeneratePassword($password);
my ( $val, $msg ) = $self->SUPER::SetPassword($password);
if ($val) {
return ( 1, $self->loc(“Password set”) ) if $new;
return ( 1, $self->loc(“Password changed”) );
}
else {
return ( $val, $msg );
}

Is your actual method called SetPassword? If so, then you need to be
calling _Set or __Set rather than SetPassword. If your method isn’t
SetPassword, you just want to call SetPassword on the local object.

(rt 3.8.1rc5)

I’ve got some custom functionality in a User_Local.pm file, trying
to
call the SetPassword method from lib/RT/User_Overlay.pm. This method
always returns (“0”, “Nonexistant field?”) when trying to get
results
from a call to the method it’s overriding; the call is around line
893
in User_Overlay.pm, in this block:

my $new = !$self->HasPassword;
$password = $self->_GeneratePassword($password);
my ( $val, $msg ) = $self->SUPER::SetPassword($password);
if ($val) {
return ( 1, $self->loc(“Password set”) ) if $new;
return ( 1, $self->loc(“Password changed”) );
}
else {
return ( $val, $msg );
}

Is your actual method called SetPassword? If so, then you need to be
calling _Set or __Set rather than SetPassword. If your method isn’t
SetPassword, you just want to call SetPassword on the local object.

Jesse -
My method is not called SetPassword; I believe I AM trying to call
SetPassword on the local object and it’s that call which seems to fail.
(Sorry, my previous message was needlessly confusing: I posted the block
of [bestpractical] code that appears to generate the error, not the
block of code I wrote. In hindsight, I realize that was rather arrogant
of me. :slight_smile:

My ~rt/local/lib/RT/User_Local.pm contains two method overrides:

ResetPassword() and IsPassword(). IsPassword() calls ResetPassword()
which calls the stock SetRandomPassword() from User_Overlay.pm, which in
turn calls $self->SetPassword($pass). The “0, Nonexistant field?” is
actually the return value from SetPassword() passed back through
SetRandomPassword().

So the gist of my problem is that when the stock SetPassword is

called on the local object with a string as argument, it barfs instead
of setting the password to the string.

...a loose approximation of a call stack:

User_Overlay.pm: SetPassword() called with 1 argument from
User_Overlay.pm: SetRandomPassword() called with no arguments from
User_Local.pm: ResetPassword() called with no arguments from
User_Local.pm: IsPassword()

What I’m trying to accomplish: If a privileged user with an unset
password (i.e. Users.Password = ‘NO-PASSWORD’) attempts to log in, I
want the web interface to act the same way that it would if an incorrect
password had been presented, but in the background a new random password
is set and the user gets an email containing that password.)

I had this working under 3.6.0. I've attached my User_Local.pm in

case it helps clarify.

Thanks for any guidance you can provide,
	Ole

/Ole Craig
Security Engineer
Team lead, customer support

ocraig@stillsecure.com
303-381-3802 main support line
303-381-3824 my voicemail
303-381-3880 fax

www.stillsecure.com

User_Local.pm (4.59 KB)

(rt 3.8.1rc5)

I’ve got some custom functionality in a User_Local.pm file, trying
to
call the SetPassword method from lib/RT/User_Overlay.pm. This method
always returns (“0”, “Nonexistant field?”) when trying to get
results
from a call to the method it’s overriding; the call is around line
893
in User_Overlay.pm, in this block:

my $new = !$self->HasPassword;
$password = $self->_GeneratePassword($password);
my ( $val, $msg ) = $self->SUPER::SetPassword($password);
if ($val) {
return ( 1, $self->loc(“Password set”) ) if $new;
return ( 1, $self->loc(“Password changed”) );
}
else {
return ( $val, $msg );
}

Is your actual method called SetPassword? If so, then you need to be
calling _Set or __Set rather than SetPassword. If your method isn’t
SetPassword, you just want to call SetPassword on the local object.

Jesse -
My method is not called SetPassword; I believe I AM trying to call
SetPassword on the local object and it’s that call which seems to
fail.
(Sorry, my previous message was needlessly confusing: I posted the
block
of [bestpractical] code that appears to generate the error, not the
block of code I wrote. In hindsight, I realize that was rather
arrogant
of me. :slight_smile:

My ~rt/local/lib/RT/User_Local.pm contains two method overrides:
ResetPassword() and IsPassword(). IsPassword() calls ResetPassword()
which calls the stock SetRandomPassword() from User_Overlay.pm,
which in
turn calls $self->SetPassword($pass). The “0, Nonexistant field?” is
actually the return value from SetPassword() passed back through
SetRandomPassword().

So the gist of my problem is that when the stock SetPassword is
called on the local object with a string as argument, it barfs instead
of setting the password to the string.

…a loose approximation of a call stack:
User_Overlay.pm: SetPassword() called with 1 argument from
User_Overlay.pm: SetRandomPassword() called with no arguments from
User_Local.pm: ResetPassword() called with no arguments from
User_Local.pm: IsPassword()

What I’m trying to accomplish: If a privileged user with an unset
password (i.e. Users.Password = ‘NO-PASSWORD’) attempts to log in, I
want the web interface to act the same way that it would if an
incorrect
password had been presented, but in the background a new random
password
is set and the user gets an email containing that password.)

I had this working under 3.6.0. I’ve attached my User_Local.pm in
case it helps clarify.

I have a sneaking suspicion that this is related to 3.8 switching
CurrentUser to be a subclass of User rather than delegating to the user.

try creating a new RT::User object as the superuser, loading the
current user’s id and going from there.

-j