Diff

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
line wrap: on
line diff
--- a/util/sasl/plain.lua	Tue Dec 11 23:40:30 2012 +0100
+++ b/util/sasl/plain.lua	Sat Dec 15 07:06:45 2012 +0500
@@ -66,15 +66,11 @@
 	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)