prosody: Enable storage manager.
[prosody.git] / plugins / mod_legacyauth.lua
index c678dce1473a6a36bfa4e9bdfd4431ff5c8f8e3b..2e1ca32825240c6d28d446ef3877a846a15fb8bb 100644 (file)
@@ -1,6 +1,6 @@
 -- Prosody IM
--- Copyright (C) 2008-2009 Matthew Wild
--- Copyright (C) 2008-2009 Waqas Hussain
+-- Copyright (C) 2008-2010 Matthew Wild
+-- Copyright (C) 2008-2010 Waqas Hussain
 -- 
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
@@ -19,11 +19,12 @@ local nodeprep = require "util.encodings".stringprep.nodeprep;
 local resourceprep = require "util.encodings".stringprep.resourceprep;
 
 module:add_feature("jabber:iq:auth");
-module:add_event_hook("stream-features", function (session, features)
-       if secure_auth_only and not session.secure then
+module:hook("stream-features", function(event)
+       local origin, features = event.origin, event.features;
+       if secure_auth_only and not origin.secure then
                -- Sorry, not offering to insecure streams!
                return;
-       elseif not session.username then
+       elseif not origin.username then
                features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up();
        end
 end);
@@ -49,7 +50,7 @@ module:add_iq_handler("c2s_unauthed", "jabber:iq:auth",
                                username = nodeprep(username);
                                resource = resourceprep(resource)
                                local reply = st.reply(stanza);
-                               if usermanager.validate_credentials(session.host, username, password) then
+                               if usermanager.test_password(username, session.host, password) then
                                        -- Authentication successful!
                                        local success, err = sessionmanager.make_authenticated(session, username);
                                        if success then