Unicode Intrinsic Functions - IsValidPassword Method

Test whether the string contains a valid password

Member of Unicode Intrinsic Functions (PRIM_LIBI.IUnicodeIntrinsics)

Parameters

NameTypeData TypeDescription
Result*Result (Optional)BooleanTrue if the string is a valid password
Strength*InputEnumerationSpecifies how strong the password needs to be

Details

The isValidPassword method allows you test whether a string adheres to the selected password policy.

Allowed Values

Enum ValueDescription
MediumMinimum 6 characters with either, one uppercase and one lowercase, one lowercase and one numeric, or one upprecase and one numeric
StrongMinimum 8 characters with at least one uppercase, one lowercase, one number and one special character (@$!%*?&)

Example

This example shows how password entry might be validated in the UI
Begin_Com Role(*EXTENDS #PRIM_WEB) Height(528) Width(896) Theme(#SYS_THEME)
 
   Define_Com Class(#PRIM_MD.Edit) Name(#Password) DisplayPosition(1) Label('Password') Left(16) Parent(#COM_OWNER) TabPosition(1) Top(16) Width(473) PasswordChar('*')
 
   Evtroutine Handling(#Password.Changed)
 
      If (#Password.Value.IsValidPassword( Medium ))
 
         #Password.HelperText := "Medium"
 
      Endif
 
      If (#Password.Value.IsValidPassword( Strong ))
 
         #Password.HelperText := "Strong"
 
      Endif
 
      If ((*Not #Password.Value.IsValidPassword( Medium )) *And (*Not #Password.Value.IsValidPassword( Strong )))
 
         #Password.HelperText := "Password must be min at least 6 with one upper, one lower and one numeric"
 
      Endif
 
   Endroutine
 
End_Com

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020