comparison mod_auth_phpbb3/mod_auth_phpbb3.lua @ 420:eaafb38daa5e

mod_auth_phpbb3: Support legacy PHPBB2 password hashes (simple MD5).
author Waqas Hussain <waqas20@gmail.com>
date Sat, 10 Sep 2011 22:37:18 +0500
parents 2a2b70e1a998
children 816d8e3e83a3
comparison
equal deleted inserted replaced
419:2a2b70e1a998 420:eaafb38daa5e
176 provider = { name = "phpbb3" }; 176 provider = { name = "phpbb3" };
177 177
178 function provider.test_password(username, password) 178 function provider.test_password(username, password)
179 --module:log("debug", "test_password '%s' for user %s", tostring(password), tostring(username)); 179 --module:log("debug", "test_password '%s' for user %s", tostring(password), tostring(username));
180 local hash = get_password(username); 180 local hash = get_password(username);
181 if hash and #hash == 32 then return hash == md5(password, true); end -- legacy PHPBB2 hash
181 return hash and phpbbCheckHash(password, hash); 182 return hash and phpbbCheckHash(password, hash);
182 end 183 end
183 function provider.user_exists(username) 184 function provider.user_exists(username)
184 module:log("debug", "test user %s existence", username); 185 module:log("debug", "test user %s existence", username);
185 return get_password(username) and true; 186 return get_password(username) and true;