From 19996b798149626de1a460658f6001f85f8564df Mon Sep 17 00:00:00 2001 From: conan (aka Fernando L. Canizo) Date: Mon, 30 May 2011 14:23:48 -0300 Subject: [PATCH] Bug 3674: reimplementation Content-Type: text/plain 05eb43f5fc00889420e03845b5059d80bf1663ad reverted a previous implementation of 3674. 3674 was encoding the password field when it was meant to be disabled (password='!'), and then, in Auth.pm we were trying to compare an encoded '!' with '!', which will never succeed. This gets sure we encode only provided passwords and also includes an auto generated login. Note: patch reworked to avoid including change already made in bug 6218 which is already pushed to master and was causing this patch to not apply. --- C4/Members.pm | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index e03b40b..267e2d9 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -800,8 +800,10 @@ Returns the borrowernumber sub AddMember { my (%data) = @_; my $dbh = C4::Context->dbh; - $data{'userid'} = '' unless $data{'password'}; - $data{'password'} = md5_base64( $data{'password'} ) if $data{'password'}; + # generate a proper login if none provided + $data{'userid'} = Generate_Userid($data{'borrowernumber'}, $data{'firstname'}, $data{'surname'}) if $data{'userid'} eq ''; + # create a disabled account if no password provided + $data{'password'} = ($data{'password'})? md5_base64($data{'password'}) : '!'; $data{'borrowernumber'}=InsertInTable("borrowers",\%data); # mysql_insertid is probably bad. not necessarily accurate and mysql-specific at best. logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog"); -- 1.7.2.5