reference:password_strength_checking_script

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
reference:password_strength_checking_script [2015/09/23 12:46] – external edit 127.0.0.1reference:password_strength_checking_script [2026/01/05 09:25] (current) paul
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 can be edited in Settings -> Scripts and is called **passwordcheck.lua** (in older versions of VPOP3 it is stored in a file called **passwordcheck.lua** in the VPOP3 directory). VPOP3 calls a function called **Check** which should have the following prototype:
  
   Check(<username>, <password>, <min password length>)   Check(<username>, <password>, <min password length>)
Line 29: Line 29:
  
 function Check(Username, Password, minlength) function Check(Username, Password, minlength)
- lowerPassword = string.lower(Password) + local lowerPassword = string.lower(Password) 
- if Password == Username then+ if Password == string.lower(Usernamethen
      return false      return false
  end  end
Line 40: Line 40:
   end   end
  
- hasDigit = 0 + local hasDigit = 0 
- hasCaps = 0 + local hasCaps = 0 
- hasLower = 0 + local hasLower = 0 
- hasSpecial = 0+ local hasSpecial = 0
  if string.find(Password, "%d") then  if string.find(Password, "%d") then
     hasDigit = 1     hasDigit = 1
Line 56: Line 56:
      hasSpecial = 1      hasSpecial = 1
  end  end
- differentTypes = hasDigit + hasCaps + hasLower + hasSpecial+ local differentTypes = hasDigit + hasCaps + hasLower + hasSpecial
    
  if differentTypes >= minTypes then  if differentTypes >= minTypes then
reference/password_strength_checking_script.1443012418.txt.gz · Last modified: 2018/11/14 10:44 (external edit)