Bugzilla – Attachment 4006 Details for
Bug 3674
Creating users with empty password
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
reimplementation
0001-Bug-3674-reimplementation.patch (text/plain), 1.92 KB, created by
Fernando L. Canizo
on 2011-04-26 15:05:41 UTC
(
hide
)
Description:
reimplementation
Filename:
MIME Type:
Creator:
Fernando L. Canizo
Created:
2011-04-26 15:05:41 UTC
Size:
1.92 KB
patch
obsolete
>From 62fc3ef6dccc0cb16694e20212a8a9a4cc90612c Mon Sep 17 00:00:00 2001 >From: conan (aka Fernando L. Canizo) <conan@lugmen.org.ar> >Date: Tue, 26 Apr 2011 11:47:11 -0300 >Subject: [PATCH] Bug 3674: reimplementation > >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. >--- > C4/Members.pm | 8 +++++--- > 1 files changed, 5 insertions(+), 3 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index a151e03..e5db97f 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"); >@@ -842,7 +844,7 @@ sub Generate_Userid { > do { > $firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g; > $surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g; >- $newuid = lc("$firstname.$surname"); >+ $newuid = lc(($firstname)? "$firstname.$surname" : $surname); > $newuid .= $offset unless $offset == 0; > $offset++; > >-- >1.7.2.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3674
:
1508
|
4006
|
4307
|
4309