On Sep 28, 2006, at 10:51 AM, Stefan Hornburg wrote:
Here is something that makes it work for me. I'm trying to get rid of my little hacks I've added over the years so I can "apt-get install interchange" easier. Thanks for maintaining it!Bill Carr wrote:I can not figure out how to use indirect_login and an AUTO_INCREMENT username column with my UserDB to create a new account.mysql> SHOW CREATE TABLE userdb; CREATE TABLE `userdb` ( `username` int(11) NOT NULL auto_increment, `email` varchar(128) NOT NULL default '', `password` varchar(20) NOT NULL default '', `acl` text, ... I've tried all kinds of combinations like below. UserDB default <<EOD { userminlen => 1, passminlen => 1, crypt => 0, time_field => 'mod_time', database => 'userdb', indirect_login => 'email', logfile => 'userdb.log', sql_counter => 'userdb:username', assign_username => 1 } I always end up with two records in my UserDB like so:mysql> SELECT username,email,password FROM userdb ORDER BY username DESC LIMIT 2;+----------+--------------------------+----------+ | username | email | password | +----------+--------------------------+----------+ | 1724 | | password | | 1723 | suppressed | | +----------+--------------------------+----------+It seems like I could make sure I have a numeric counter file with a value at least as high as MAX(username) but that seems like something that should be able to be avoided. Is there a way to use an AUTO_INCREMENT username column with indirect_login in Interchange?The problem is that IC creates first a record with just username/ password and fills in the details later. Personally, I thinkaccounts should created in an atomic operation.
--- interchange-5.4.1/lib/Vend/UserDB.pm 2005-11-09 04:04:18.000000000 -0500 +++ /usr/lib/interchange/Vend/UserDB.pm 2006-09-28 11:44:32.000000000 -0400
@@ -1047,7 +1047,6 @@
# Show this generic error message on login page to avoid
# helping would-be intruders
my $stock_error = errmsg("Invalid user name or password.");
-
eval {
unless($self) {
$self = new Vend::UserDB %options;
@@ -1560,21 +1559,22 @@
die errmsg("Username already exists.") . "\n";
}
- if($foreign) {
- $udb->set_field(
- $self->{USERNAME},
- $foreign,
- $self->
{PASSED_USERNAME},
- )
- or die errmsg("Database access error.");
- }
+ my $fary;
+ my $vary;
+ push @$fary, $self->{LOCATION}{PASSWORD};
+ push @$vary, $pw;
+ if($foreign) {
+ push @$fary,$foreign;
+ push @$vary,$self->{PASSED_USERNAME};
+ }
+
+ my $pass = $udb->set_slice(
+ $self->{USERNAME},
+ $fary,
+ $vary,
+ );
- my $pass = $udb->set_field(
- $self->{USERNAME},
- $self->{LOCATION}
{PASSWORD},
- $pw, - );- die errmsg("Database access error.") . "\n" unless defined $pass; + die ::errmsg("Database access error.") . "\n" unless defined $pass;
Bill Carr Bottlenose - Wine & Spirits eBusiness Specialists (877) 857-6700 http://www.bottlenose-wine.com Download vCard _______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.