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); |