How to create a basic login/logout system for Elipse SCADA.

To create a basic login/logout system for users of Elipse SCADA, you must first make sure that users have been created. To do so, just open the Organizer and, at Users menu, create as many users as needed.


LOGIN and LOGOUT browsing buttons

Create a momentary button on your application’s Initial Screen with the message “LOGIN”. Write the following script at this button’s OnPress event:

Aplication.Login()

This function opens up a box for inserting usernames and passwords. When pressing OK, if the information is correct, the application will understand there is a user logged in the system.

Then, create “LOGOUT” buttons on the other screens in the application. They must display the following script (also at OnPress event):

Aplication.Logout()

When clicking one of these buttons, the application understands there is no user logged in the system.


Login and logout actions

The next step is to choose the course of action to be taken when logging in or out the application. In the example, a new screen is open whenever a user logs in the application and the initial screen returns when they log out the application.

At the Organizer, create a script at Application’s OnUserLogin event:

Screen2.Activate()

In this case, the login will cause the other screen to open.

Then, write the following script at Application’s OnUserLogout event:

InitialScreen.Activate()

In this case, the logout will cause the Initial Screen to open; thus, the user will have to use the former button to log in, and then continue browsing the other screens.

Error message for incorrect login

If you type an incorrect username and/or password, the application’s Login() function’s default behavior is to do nothing. But you can add an error message to this system, so it will have a clearer outlook.

Elipse SCADA’s Global Manager has a property called lastError, which will return values according to the action executed in the login box. Login() function also returns values that can be used in this situation.

However, to keep this system simple, we will create an internal tag indicating whether there is a user logged in. Its values are 0 (no user logged in) and 1 (a user logged in).

To do so, create a RAM tag called LoggedUser. Then, add the following line at the Application’s OnUserLogin event:

LoggedUser = 1

Do the same at OnUserLogout event, but use value 0 instead.

LoggedUser = 0

Then, add a script to “LOGIN” button to test the tag’s value, checking for the presence of logged in users. If there are no users logged in, it will display the following error message:

Application.Login()
IF LoggedUser == 0
     MessageBox (“Username or password incorrect! “)
ENDIF

Final Remarks

This article has demonstrated how relatively easy it is to create a basic login/logout system for your application, as long as proper care is taken during screen browsing. For example, make sure the logout will open the main screen, so it does not become impossible for the user to log in again later.

Also, several other features can be implemented, such as displays showing the logged in user’s username and access level, among others. For these, we suggest you refer to Elipse SCADA’s User’s Manual, installed alongside the software.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *