Comparison

util/sasl/plain.lua @ 5240:864b27ddaa10

util.sasl.plain: Reduce some code.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 15 Dec 2012 07:06:45 +0500
parent 4920:e27adbf4e743
child 5301:6279caf921f1
comparison
equal deleted inserted replaced
5238:0cc0359d8c39 5240:864b27ddaa10
64 end 64 end
65 65
66 self.username = authentication 66 self.username = authentication
67 if state == false then 67 if state == false then
68 return "failure", "account-disabled"; 68 return "failure", "account-disabled";
69 elseif state == nil then 69 elseif state == nil or not correct then
70 return "failure", "not-authorized", "Unable to authorize you with the authentication credentials you've sent."; 70 return "failure", "not-authorized", "Unable to authorize you with the authentication credentials you've sent.";
71 end 71 end
72 72
73 if correct then 73 return "success";
74 return "success";
75 else
76 return "failure", "not-authorized", "Unable to authorize you with the authentication credentials you've sent.";
77 end
78 end 74 end
79 75
80 function init(registerMechanism) 76 function init(registerMechanism)
81 registerMechanism("PLAIN", {"plain", "plain_test"}, plain); 77 registerMechanism("PLAIN", {"plain", "plain_test"}, plain);
82 end 78 end