Login

From nuBuilderForte
Jump to navigation Jump to search

Logging into nuBuilder Forte

There are multiple ways to log in to nuBuilder Forte, which can be done either manually or automatically using URL parameters.

Manual Login

To log in manually, follow these steps:

  1. Navigate to the web directory where nuBuilder Forte is installed.
  2. Enter your username.
  3. Enter your password.
  4. Press Enter or click "Log in".

Auto Login

You can automate the login process by passing specific parameters in the URL. Below are the available parameters and their descriptions:

  • u: Username
  • p: Password
  • f: Form ID
  • r: Record ID
  • h: Home Page ID

Parameter Passing in GET URL

By including certain parameters in the URL for index.php, you can achieve different types of automatic logins:

  • Login to the User's Home Page:
 index.php?u=1&p=1
  • Login to a specific Form and Record:
 index.php?u=1&p=1&f=nublank&r=-1
  • Login to a specific Form and Record with a link to the User's Home Page:
 index.php?u=1&p=1&f=nublank&r=-1&h=nuuserhome
  • Prompt for the user's password before logging into the User's Home Page:
 index.php?u=1
  • Prompt for the user's password before logging into a specific Form and Record:
 index.php?u=1&f=nublank&r=-1
  • Prompt for the user's password before logging into a specific Form and Record with a link to the User's Home Page:
 index.php?u=1&f=nublank&r=-1&h=nuuserhome

Custom Parameters

All the parameters, including custom parameters, can be retrieved with the PHP function nuGetURLParams(). The password value (parameter 'p') cannot be retrieved by this function.

Single-Use Password Token

It is possible to use a single-use token instead of the the normal password when logging in.  This may be preferable when using the auto-login where the password is included in the URL.

After a successful login, the token is replaced with a new random value and so it will only work once.  It is stored as a JSON key-value pair in zzzzsys_user.sus_json and can be extracted using the following code.

 $user_id = '5f958ad8b8c613d';
 $j = db_fetch_value('zzzzsys_user', 'zzzzsys_user_id', $user_id , 'sus_json');
 $login_token = nuJsonDecode($j, true)['LOGIN_TOKEN'];

For more information, including Purpose of the Token System, Use Cases, please see Single-Use Password Token.

Customizing Login HTML

You can customize the login page HTML by modifying the nuconfig.php file. Within this file, there is a commented-out variable named $nuWelcomeBodyInnerHTML. This variable can be customized and utilized as the login page content.

The HTML login form code, stored in the $welcome variable in index.php, escapes the value of $nuWelcomeBodyInnerHTML. This is then used in the JavaScript function nuLogin(nuconfigNuWelcomeBodyInnerHTML) defined in the nucommon.js file. If $nuWelcomeBodyInnerHTML is not set, a default value within the nuLogin function is used.

The JavaScript function nuLoginRequest(u, p), defined in index.php, processes the login credentials. This function uses AJAX to call the nuBuilder API functions in the nuapi.php file.