login

[ Function ]

public static login(
    username: string | null | undefined,
    password: string | null | undefined,
    persistent: boolean = true,
    callback?: (
        data: TcHmi.IResultObject
    ) => void
): boolean;

Logs in a new user. If this is successful, the client is reloaded.

Parameter

Name

Type

Description

username

string, null, undefined

User name

password

string, null, undefined

Password

persistent

boolean

Defines whether a session should survive a browser restart.

callback [ optional ]

(data: TcHmi.IResultObject) => void

Asynchronous callback function that is triggered when the operation was terminated.

Return value

Type

Description

boolean

Returns confirmation as to whether the operation was successfully sent.

login 1:

Available from 1.8

Sample - JavaScript

TcHmi.Server.login('Admin', 'sj5TzYkKExYgCcW', false, function(data) {
    if (data.error === TcHmi.Errors.NONE) {
        // Success
    } else {
        // Error
    }
});