Mercurial > prosody-hg
comparison core/usermanager.lua @ 3166:3c46cb94caed
Add mechanism for upgrading to hashed passwords from default. Remove some extra debug.
| author | Jeff Mitchell <jeff@jefferai.org> |
|---|---|
| date | Thu, 27 May 2010 10:54:11 -0400 |
| parents | db9def53fe9c |
| children | 546695e80e0a |
comparison
equal
deleted
inserted
replaced
| 3165:4ffb5469c1f6 | 3166:3c46cb94caed |
|---|---|
| 28 local function dummy() end; | 28 local function dummy() end; |
| 29 return setmetatable({name = "dummyauth"}, { __index = function() return dummy; end }); | 29 return setmetatable({name = "dummyauth"}, { __index = function() return dummy; end }); |
| 30 end | 30 end |
| 31 | 31 |
| 32 local function host_handler(host) | 32 local function host_handler(host) |
| 33 log("debug", "host_handler called with host '%s'", host); | |
| 34 local host_session = hosts[host]; | 33 local host_session = hosts[host]; |
| 35 host_session.events.add_handler("item-added/auth-provider", function (event) | 34 host_session.events.add_handler("item-added/auth-provider", function (event) |
| 36 local provider = event.item; | 35 local provider = event.item; |
| 37 if provider == nil then | |
| 38 log("debug", "auth provider is nil"); | |
| 39 else | |
| 40 log("debug", "auth provider is not nil"); | |
| 41 end | |
| 42 if provider.name == nil then | |
| 43 log("debug", "authentication provider name is nil"); | |
| 44 else | |
| 45 log("debug", "authentication provider name = '%s'", provider.name); | |
| 46 end | |
| 47 if config.get(host, "core", "authentication") == nil and provider.name == "default" then | 36 if config.get(host, "core", "authentication") == nil and provider.name == "default" then |
| 48 host_session.users = provider; | 37 host_session.users = provider; |
| 49 elseif config.get(host, "core", "authentication") == provider.name then | 38 elseif config.get(host, "core", "authentication") == provider.name then |
| 50 host_session.users = provider; | 39 host_session.users = provider; |
| 51 end | 40 end |
| 52 if host_session.users ~= nil and host_session.users.name ~= nil then | 41 if host_session.users ~= nil and host_session.users.name ~= nil then |
| 53 log("debug", "host_session.users.name for host '%s' now '%s'", host, host_session.users.name); | 42 log("debug", "host '%s' now set to use user provider '%s'", host, host_session.users.name); |
| 54 end | 43 end |
| 55 end); | 44 end); |
| 56 host_session.events.add_handler("item-removed/auth-provider", function (event) | 45 host_session.events.add_handler("item-removed/auth-provider", function (event) |
| 57 local provider = event.item; | 46 local provider = event.item; |
| 58 if host_session.users == provider then | 47 if host_session.users == provider then |
