Login: Difference between revisions

From nuBuilderForte
Jump to navigation Jump to search
(Update Login)
(Login / Custom Parameters)
Line 43: Line 43:
* '''Prompt for the user's password before logging into a specific Form and Record with a link to the User's Home Page:'''
* '''Prompt for the user's password before logging into a specific Form and Record with a link to the User's Home Page:'''
   <nowiki>index.php?u=1&f=nublank&r=-1&h=nuuserhome</nowiki>
   <nowiki>index.php?u=1&f=nublank&r=-1&h=nuuserhome</nowiki>
=== Custom Parameters ===
Custom parameters can be retrieved using the `nuGetURLParams()` function.
==== Example ====
Below is an example of how to use the `nuGetURLParams()` function to retrieve a custom parameter. Assume a parameter `company` with the value "nusoft" is passed in the URL.
'''Example URL:'''
<nowiki>index.php?company=nusoft</nowiki>
'''PHP Code:'''
<code>
// Retrieve custom parameters
$params = nuGetURLParams();
$company = $params['company'] ?? '';
echo "Company: " . $company; // Output: Company: nusoft
</code>


=== Customizing Login HTML ===
=== Customizing Login HTML ===

Revision as of 10:56, 12 June 2024

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

Custom parameters can be retrieved using the `nuGetURLParams()` function.

Example

Below is an example of how to use the `nuGetURLParams()` function to retrieve a custom parameter. Assume a parameter `company` with the value "nusoft" is passed in the URL.


Example URL:

index.php?company=nusoft


PHP Code:

// Retrieve custom parameters

$params = nuGetURLParams(); $company = $params['company'] ?? ;

echo "Company: " . $company; // Output: Company: nusoft


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.