Comparison

core/usermanager.lua @ 3113:30896751dd43

usermanager: Take datamanager errors into account when determining account existance.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 24 May 2010 00:49:12 +0500
parent 3064:596303990c7c
child 3116:90a98a6b52ac
comparison
equal deleted inserted replaced
3112:c311fdffccce 3113:30896751dd43
67 return nil, "Account not available."; 67 return nil, "Account not available.";
68 end 68 end
69 69
70 function user_exists(username, host) 70 function user_exists(username, host)
71 if not(require_provisioning) and is_cyrus(host) then return true; end 71 if not(require_provisioning) and is_cyrus(host) then return true; end
72 return datamanager.load(username, host, "accounts") ~= nil; -- FIXME also check for empty credentials 72 local account, err = datamanager.load(username, host, "accounts");
73 return (account or err) ~= nil; -- FIXME also check for empty credentials
73 end 74 end
74 75
75 function create_user(username, password, host) 76 function create_user(username, password, host)
76 if not(require_provisioning) and is_cyrus(host) then return nil, "Account creation/modification not available with Cyrus SASL."; end 77 if not(require_provisioning) and is_cyrus(host) then return nil, "Account creation/modification not available with Cyrus SASL."; end
77 return datamanager.store(username, host, "accounts", {password = password}); 78 return datamanager.store(username, host, "accounts", {password = password});