Python Command: Login

Use the Login commands in Python to retrieve information specific to the current GainSeeker User. This information can be edited on the Users tab of the Administration module.

See Python commands for other commands you can use with GainSeeker.

 

Contents  [Hide]

 

Login command table

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

login.computeruser

login.computeruser

Returns the name of the currently logged in Windows user.

 

login.configid

login.configid

Returns the internal number of the GainSeeker configuration used by the currently logged in GainSeeker user.

 

login.configname

login.configname

Returns the name of the GainSeeker configuration used by the currently logged in GainSeeker user.

8.9

login.emailaddress

login.emailaddress

Returns the email address of the currently logged in GainSeeker user.  The email address can be edited on the Users tab of the Administration module.

 

login.emailpassword

login.emailpassword

Returns the email password of the currently logged in GainSeeker user.  The email password can be edited on the Users tab of the Administration module.

 

login.emailport

login.emailport

Returns the email port number for the GainSeeker system. The email port number can be edited on the Configurations tab of the Administration module in the System-wide settings branch.

 

login.emailserver

login.emailserver

Returns the name of the email server for the GainSeeker system.  The email server name can be edited on the Configurations tab of the Administration module in the System-wide settings branch.

 

login.emailusername

login.emailusername

Returns the email user name of the currently logged in GainSeeker user.  The email user name can be edited on the Users tab of the Administration module.

 

login.language

login.language

Returns the two-letter code for the current application's display language.

For PC Collect this may return "en" (English), "es" (Spanish), or "fr" (French).

For all other GainSeeker applications - including the GainSeeker Inspections module where you can debug Python scripts for PC Collect - this will return "en".

9.3

login.roleid

login.roleid

Returns the internal number of the GainSeeker Role used by the currently logged in GainSeeker user.

 

login.rtfstrs

login.rtfstrs

Returns a list of all possible real-time failure messages for the current user’s configuration.

9.2

login.userid

login.userid

Returns the internal number of the currently logged in GainSeeker user.

 

login.username

login.username

Returns the name of the currently logged in GainSeeker user.

 

login.verifypassword(password, level=0, username="")

login.verifypassword("Eclipse17")

This checks the supplied password ("Eclipse17") against the current user's login password and returns True if the password is correct or False otherwise.

Checks a password string against a user's login password and verifies that the password is correct.

Returns True if the password is correct and False otherwise.

The password is the password being verified.

The level (optional) is an integer representing which password this dialog will verify: 0 = Login password, 1 = Level 1 password, and 2 = Level 2 password.

The username (optional) is the user whose password is being verified. If not specified, this is the currently logged-in user.

When validating the Login password (level=0), if GainSeeker is configured for Active Directory integration, it will use Active Directory usernames and passwords. If using Windows credentials as Active Directory credentials, you can still use the username parameter to specify a user other than the currently logged-in Windows user.

 

You can use this command with disp.newtextbox(multiline=False) and the .usepasswordchar property to create a custom password verification form.

9.3

Example

This example uses the Python Email command and is an example of using the Python login commands to set email properties instead of hard coding those properties inside the script.

#Set the username and password if login is required to send emails for the current user.

email.username = login.username

email.password = login.password

#Set the email port if using a non-standard port

email.port = login.emailport

#Set the name of the email server and the "from" address

email.server = login.emailserver

email.from_address = login.email.address

#Send the email

email.send("joanne@acme.com", "Daily email", "This is the message", False, None)

For more email examples, see the Python Email command.