util.sasl.plain: Reduce some code.
authorWaqas Hussain <waqas20@gmail.com>
Sat, 15 Dec 2012 02:06:45 +0000 (07:06 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Sat, 15 Dec 2012 02:06:45 +0000 (07:06 +0500)
util/sasl/plain.lua

index ba4645e10bb08ce0ffa77c58699e351b070be7a7..d108a40de9ddf4292cf1ec6f19e7bddb344824f8 100644 (file)
@@ -66,15 +66,11 @@ local function plain(self, message)
        self.username = authentication
        if state == false then
                return "failure", "account-disabled";
-       elseif state == nil then
+       elseif state == nil or not correct then
                return "failure", "not-authorized", "Unable to authorize you with the authentication credentials you've sent.";
        end
 
-       if correct then
-               return "success";
-       else
-               return "failure", "not-authorized", "Unable to authorize you with the authentication credentials you've sent.";
-       end
+       return "success";
 end
 
 function init(registerMechanism)