Foundation 6

Fnd_Pswd

15 shared methods.

Fnd_Pswd_BulletEntry

Fnd_Pswd_BulletEntry (->visible object; ->text variable)

Replaces typed characters with bullet characters for password entry.

Based on the Keystroke function example in the 4D documentation.

Requires the field's On Before Keystroke event is enabled.

ParameterTypeDirectionDescription
bulletFieldPointerinThe displayed variable
actualFieldPointerinThe entered value

Fnd_Pswd_CustomCharacters

Fnd_Pswd_CustomCharacters ({characters}) --> Text

Pass any custom characters that should be used to generate passwords.

Returns the currently specified custom characters.

ParameterTypeDirectionDescription
inCharactersTextinCustom characters to use (optional)
ResultTextoutThe current custom characters

Fnd_Pswd_ExcludeCharacters

Fnd_Pswd_ExcludeCharacters ({characters}) --> Text

Pass any characters that should be excluded from generate passwords.

Returns the currently specified excluded characters.

ParameterTypeDirectionDescription
inCharactersTextinCharacters to exclude (optional)
ResultTextoutThe current list of excluded characters

Fnd_Pswd_GeneratePassword

Fnd_Pswd_GeneratePassword ({options}) --> Text

Generates a password.

With no parameter it uses the module's stored settings, as it always has.

Pass an object to generate under different settings without changing the stored ones, which is also what makes it safe to call from a worker:

Fnd_Pswd_GeneratePassword({length: 16; useSymbols: False})
Fnd_Pswd_GeneratePassword({type: Fnd_Pswd_TypePronounceable})
Fnd_Pswd_GeneratePassword({type: Fnd_Pswd_TypePIN; length: 6})
The three types: Fnd_Pswd_TypeRandom        - characters drawn from the classes in use Fnd_Pswd_TypePronounceable - syllables, in the shape macOS offers; see Fnd_Pswd_Pronounceable for the exact form Fnd_Pswd_TypePIN           - digits only, and the exclusion list does not apply, so all ten are available

A random password holds at least one character from every class in use, so asking for numbers means getting one. Set requireEachClass to False for the older behaviour of drawing every character from the pooled set.

ParameterTypeDirectionDescription
optionsVariantinSettings to override for this call (optional)
ResultTextoutThe generated password

Fnd_Pswd_GeneratorDialog

Fnd_Pswd_GeneratorDialog --> Text

Displays a password generator dialog.

ParameterTypeDirectionDescription
ResultTextoutThe generated password, or "" if cancelled

Fnd_Pswd_GetValidCharacters

Fnd_Pswd_GetValidCharacters ({options}) --> Text

Returns a string with all of the allowed password characters (based on the user's preference settings).

Pass an object to answer for settings other than the stored ones, without changing them:

Fnd_Pswd_GetValidCharacters({useSymbols: False; excludedCharacters: "0O"})
ParameterTypeDirectionDescription
optionsVariantinSettings to override for this call (optional)
ResultTextoutA string of all valid characters

Fnd_Pswd_Info

Fnd_Pswd_Info (label) --> Text

Returns requested information. See the Fnd_Gen_ComponentInfo method for more information.

ParameterTypeDirectionDescription
requestTextinInfo desired ("version" or "name")
ResultTextoutResponse

Fnd_Pswd_Localize

Fnd_Pswd_Localize

Passed the localization strings to the General and (if available) Localization components.

No parameters.

Fnd_Pswd_MaxLength

Fnd_Pswd_MaxLength ({max chars to use{; max limitation}}) --> Number

Allows the developer to set the maximum password length, and optionally the maximum password length defined in the Generator dialog. Returns the current value of the maximum password length.

ParameterTypeDirectionDescription
inMaxCharsLongintinThe maximum password length setting (optional)
inMaxLimitationLongintinThe maximum value displayed in the pop-up menu (optional)
ResultLongintoutThe currently set maximum length

Fnd_Pswd_MinLength

Fnd_Pswd_MinLength ({min chars to use{; min limitation}}) --> Number

Allows the developer to set the Minimum password length, and optionally the Minimum password length defined in the Generator dialog. Returns the current value of the Minimum password length.

ParameterTypeDirectionDescription
inMinCharsLongintinThe Minimum password length setting (optional)
inMinLimitationLongintinThe Minimum value displayed in the pop-up menu (optional)
ResultLongintoutThe currently set Minimum length

Fnd_Pswd_Strength

Fnd_Pswd_Strength ($password_t : Text {; $options_v : Variant}) --> Object

How much work guessing the password would be, given only its length and the character classes it draws on.

$strength_o:=Fnd_Pswd_Strength("Tr0ub4dor&3")
$strength_o.bits    -->  72.1
$strength_o.rating  -->  3

rating runs 0 to 4 — very weak, weak, reasonable, strong, very strong — at the customary boundaries of 28, 36, 60 and 128 bits. Pass rating through Fnd_Gen_GetString("Fnd_Pswd"; "Strength"+String(rating)) for a localized name.

By default this counts the pool a guesser would have to search, which is an upper bound rather than a judgement: it cannot know a password is a dictionary word, and it badly overstates a pronounceable one, whose syllables are far more constrained than its letters suggest.

So tell it what it is looking at when you know:

Fnd_Pswd_Strength($password_t; {type: Fnd_Pswd_TypePronounceable})

which counts the passwords that shape can actually produce instead — about 79 bits for the three-group default, against the 131 its characters imply.

ParameterTypeDirectionDescription
passwordTextinThe password to weigh
optionsVariantin{ type } — how it was generated, if known (optional)
ResultObjectout{ length ; poolSize ; bits ; rating }

Fnd_Pswd_UseLowercase

Fnd_Pswd_UseLowercase ({use Lowercase?}) --> Boolean

Pass True to tell the password generator to use lowercase letters in passwords.

Returns the current setting.

ParameterTypeDirectionDescription
inLowercaseBooleaninTrue to use lowercase letters (optional)
ResultBooleanoutTrue if lowercase letters can be used

Fnd_Pswd_UseNumbers

Fnd_Pswd_UseNumbers ({use numbers?}) --> Boolean

Pass True to tell the password generator to use numbers in passwords.

Returns the current setting.

ParameterTypeDirectionDescription
inNumbersBooleaninTrue to use numbers (optional)
ResultBooleanoutTrue if numbers can be used

Fnd_Pswd_UseSymbols

Fnd_Pswd_UseSymbols ({use symbols?}) --> Boolean

Pass True to tell the password generator to use symbols in passwords.

Returns the current setting.

ParameterTypeDirectionDescription
inSymbolsBooleaninTrue to use symbols (optional)
ResultBooleanoutTrue if symbols can be used

Fnd_Pswd_UseUppercase

Fnd_Pswd_UseUppercase ({use uppercase?}) --> Boolean

Pass True to tell the password generator to use uppercase letters in passwords.

Returns the current setting.

ParameterTypeDirectionDescription
inUppercaseBooleaninTrue to use uppercase letters (optional)
ResultBooleanoutTrue if uppercase letters can be used