Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Thursday, March 10, 2011

resetting password for user in authlogic

I needed to quickly reset a user's password in an Rails application that used authlogic. I didn't have the nice 'request reminder' stuff set up, so I used the console instead:

././script/console production
...
>> forgetfulUser = User.find(:first, :conditions => {:login => 'richard'})
...
...
>> forgetfulUser.password = 'newPassw0rd'
>> forgetfulUser.password_confirmation = 'newPassw0rd'
>> forgetfulUser.save

and it was done.

Thursday, August 7, 2008

enhancement to the code

Well, I wondered if this should be part of the catalyst book errerta, but in the end I decided that the code in the book worked, so it wasn't in error.

I have been working through the book using Pg instead of SQLite. The big difference with Pg is that a user/pass are needed. I've navigated a few hurdles on the way, and this afternoon I found another one.

When including a script within your catalyst app, it is The Book has an excellent example which properly integrates your script with the existing config files.

If you construct a DSN in the following way, you can also use the user/pass conbination from your config file!

my @dsn = @{$config->{'Model::AddressDB'}->{connect_info}};

my $HOME = dir($Bin, '..');
$dsn[0] =~ s/__HOME__/$HOME/;

my $schema = AddressBook::Schema::AddressDB->connect(@dsn)
or die "Failed to connect to database at $dsn[0]";