util/sasl/plain.lua

changeset 2206
78c9b5255b27
parent 2205
adbedc32d41b
child 2252
98a2bc275e0e
equal deleted inserted replaced
2205:adbedc32d41b 2206:78c9b5255b27
33 authentication = saslprep(authentication); 33 authentication = saslprep(authentication);
34 password = saslprep(password); 34 password = saslprep(password);
35 35
36 if (not password) or (password == "") or (not authentication) or (authentication == "") then 36 if (not password) or (password == "") or (not authentication) or (authentication == "") then
37 log("debug", "Username or password violates SASLprep."); 37 log("debug", "Username or password violates SASLprep.");
38 return "failure", "malformed-request"; 38 return "failure", "malformed-request", "Invalid username or password.";
39 end 39 end
40 40
41 local correct, state = false, false; 41 local correct, state = false, false;
42 if self.profile.plain then 42 if self.profile.plain then
43 local correct_password; 43 local correct_password;
53 end 53 end
54 54
55 if correct then 55 if correct then
56 return "success"; 56 return "success";
57 else 57 else
58 return "failure", "not-authorized"; 58 return "failure", "not-authorized", "Unable to authorize you with the authentication credentials you've sent.";
59 end 59 end
60 end 60 end
61 61
62 function init(registerMechanism) 62 function init(registerMechanism)
63 registerMechanism("PLAIN", {"plain", "plain_test"}, plain); 63 registerMechanism("PLAIN", {"plain", "plain_test"}, plain);

mercurial