User Tools

Site Tools


reference:password_strength_checking_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
reference:password_strength_checking_script [2014/02/27 17:29] – created paulreference:password_strength_checking_script [2015/09/23 13:46] – external edit 127.0.0.1
Line 19: Line 19:
  else  else
   return true   return true
 + end
 +end
 +</code>
 +
 +A more complex example is:
 +<code>
 +blockedWords = {"password", "letmein", "computer"}
 +minTypes = 3
 +
 +function Check(Username, Password, minlength)
 + lowerPassword = string.lower(Password)
 + if Password == Username then
 +     return false
 + end
 +
 +  for _, value in pairs(blockedWords) do
 +    if lowerPassword == value then
 +      return false
 +    end
 +  end
 +
 + hasDigit = 0
 + hasCaps = 0
 + hasLower = 0
 + hasSpecial = 0
 + if string.find(Password, "%d") then
 +    hasDigit = 1
 + end
 + if string.find(Password, "[A-Z]") then
 +    hasCaps = 1
 + end
 + if string.find(Password, "[a-z]") then
 +     hasLower = 1
 + end
 + if string.find(Password, "[^a-zA-Z0-9]") then
 +     hasSpecial = 1
 + end
 + differentTypes = hasDigit + hasCaps + hasLower + hasSpecial
 + 
 + if differentTypes >= minTypes then
 +     return true
 + else
 +     return false
  end  end
 end end
reference/password_strength_checking_script.txt · Last modified: 2018/11/14 10:45 by 127.0.0.1