Date:  06/09/2011 01:19:46 PM Msg ID:  004292
From:  FoxWeb Support Thread:  004291
Subject:  Re: To authenticate or not to Authenticate
I'm not entirely sure I understand your question. I do understand that you modified the code in fw_enter.prg, so that users are required to login for every page other than the main page.
 
Are you asking how to determine whether you are logged in, so that you can display different content in the main page? To determine if a user has already logged in, you can call Auth.Authenticate(.T.). Passing .T. instructs this method to check login and return true/false without sending the login form to the browser. After Auth.Authenticate returns true, you can find out the user id via Auth.UserId.
 
Note that you must set the Auth.AuthTable or Auth.AuthList the same way that they are set during normal calls to Auth.Authenticate for this to work.
 
fw_enter.prg:

Auth.AuthTable = "your authentication table"

IF (this is the main page)

    * This will populate Auth.UserId if the user is logged in 

    Auth.Authenticate(.T.)

ELSE

    * This will display the login form if the user is not logged in 

    Auth.Authenticate() 

ENDIF 

 
Main page:

IF Auth.UserId != .NULL.

   * Show content that should only be visible to logged in users

ENDIF

* Show content that all users can see 

 
 
FoxWeb Support Team
support@foxweb.com email
Sent by Ali Koumaiha on 06/09/2011 11:20:16 AM:
i have a portal for a customer, where all pages must be protected.

so, i have the Auth.Authenticate in the fw_enter.prg, which is working perfectly.

now, the customer has changed their business practice, and they want one page, (the main page sort of), to be unprotected, with minimal display of content, and then, when the user clicks log in, the content will change obviously.

so, i was able to make the page not to ask for authentication

in my fw_enter:

if lcScript = "the script i want to prvent"
if glDoNotAuthenticate
  Auth.authenticate && rest of the pages are authenticating.
endif

but, now, how do i make it where the login.fwx form authenticate that script?

similar to how you have it on this forum here..