This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| reference:password_strength_checking_script [2014/02/27 17:29] – created paul | reference:password_strength_checking_script [2018/11/14 10:45] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| You can tell VPOP3 to enforce password strength checks by using a Lua script which performs the checks for you. | You can tell VPOP3 to enforce password strength checks by using a Lua script which performs the checks for you. | ||
| - | The Lua script is stored in a file called **passwordcheck.lua** in the VPOP3 directory. VPOP3 calls a function called **Check** which should have the following prototype: | + | The Lua script |
| Check(< | Check(< | ||
| Line 19: | Line 19: | ||
| else | else | ||
| return true | return true | ||
| + | end | ||
| + | end | ||
| + | </ | ||
| + | |||
| + | A more complex example is: | ||
| + | < | ||
| + | blockedWords = {" | ||
| + | minTypes = 3 | ||
| + | |||
| + | function Check(Username, | ||
| + | | ||
| + | if Password == Username then | ||
| + | | ||
| + | end | ||
| + | |||
| + | for _, value in pairs(blockedWords) do | ||
| + | if lowerPassword == value then | ||
| + | return false | ||
| + | end | ||
| + | end | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | if string.find(Password, | ||
| + | hasDigit = 1 | ||
| + | end | ||
| + | if string.find(Password, | ||
| + | hasCaps = 1 | ||
| + | end | ||
| + | if string.find(Password, | ||
| + | | ||
| + | end | ||
| + | if string.find(Password, | ||
| + | | ||
| + | end | ||
| + | | ||
| + | |||
| + | if differentTypes >= minTypes then | ||
| + | | ||
| + | else | ||
| + | | ||
| end | end | ||
| end | end | ||