Log In    |    Knowledge Base    |    4D Home
Tech Tip: Supporting Guest login to a 4D Ajax Framework supported web site
PRODUCT: 4D Web 2.0 Pack | VERSION: 11.5 | PLATFORM: Mac & Win
Published On: January 8, 2010

When using the 4D Ajax Framework (4DAF) there may be a desire to allow guests or the public to have access to your website without having to add "Guest", "Public", etc. to the list of database users to get past the password requirement. This can be done in the 4DAF method DAX_DevHook_Login.

The DAX_DevHook_Login method is provided for the Developer to override the default DAX login system which depends on 4D's native password system. If your database uses a custom password system, this is the method that is used to access the custom login system.

To implement this you need to insert code following the lines:

$userName_t:=DAX_Dev_GetWebVar ("username")
$password_t:=DAX_Dev_GetWebVar ("password")

This is the code to insert:

`// To be able to allow unregistered users to "view" website content.
`// set to True if the user successfully logs in

$loggedIn_b:=(($userName_t="Guest") | ($userName_t="Public"))

Guests will now be able to log into your website without a password. By adding these lines during development, even when no password system is installed at all, it will allow multiple users to login with the same name, with each login getting its own session ID. Otherwise each login of the same name will invalidate all previous logins.