# Login Implementation

There are several ways to implement authentication. The following is a simple example that returns a message as a basis for starting out.

1. In Application Explorer | Users, create some user-password pairs (or use existing ones).
2. In Tag Manager, create the tag Loginstatus, Boolean type.
3. Place the following on a page called Page.
   - Textbox called TextBoxLoginName.
   - Password box called PasswordBox.
   - A button.
4. Right-click on the button and select Scripts | Mouse Click.
5. Enter the script example below.
6. Compile and run.

    // use Login ( <user_name>, <password>) that return 1 or 0 (success/ failure)
    // assign value to a tag  one creates in tag manager called  $Logingstatus with type of Boolean
    // changes to page name and or object will require adjustments to relevant names

    $Logingstatus=$System.Users.Login($Pages.Page.TextBoxLoginName.Text, $Pages.Page.PasswordBox.Password);
    // simplest of code to show a popup message for success or failure

    if (Logingstatus)
    	{
    	$HMI.ShowInformation ( "Successful login","Login status message" );
    	}
    else
    	{
    	$HMI.ShowInformation ( "Login Failed","Login status message" );
    	}