45 end |
45 end |
46 return true; |
46 return true; |
47 end |
47 end |
48 |
48 |
49 function user_exists(params) |
49 function user_exists(params) |
50 local provider = prosody.hosts[params.host].users; |
50 local user, host, password = nodeprep(params.user), nameprep(params.host), params.password; |
|
51 local provider = prosody.hosts[host].users; |
51 if not(provider) or provider.name == "null" then |
52 if not(provider) or provider.name == "null" then |
52 usermanager.initialize_host(params.host); |
53 usermanager.initialize_host(host); |
53 end |
54 end |
54 |
55 |
55 return usermanager.user_exists(params.user, params.host); |
56 return usermanager.user_exists(user, host); |
56 end |
57 end |
57 |
58 |
58 function passwd(params) |
59 function passwd(params) |
59 if not _M.user_exists(params) then |
60 if not _M.user_exists(params) then |
60 return false, "no-such-user"; |
61 return false, "no-such-user"; |