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

Ole Craig ocraig at stillsecure.com
Mon Sep 8 20:51:44 EDT 2008


On Sun, 2008-09-07 at 13:47 -0400, Jesse Vincent wrote:
> On Sep 5, 2008, at 9:46 PM, Ole Craig wrote:
> 
> > (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. :-)

    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 at stillsecure.com
303-381-3802 main support line
303-381-3824 my voicemail
303-381-3880 fax

www.stillsecure.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: User_Local.pm
Type: application/x-perl
Size: 4697 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080908/3a46c659/attachment.bin>


More information about the rt-users mailing list