function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MehaMeha 

Session Management in force.com

Hi

 

I have made a website using the free domain of site.com and I have used the default SiteLogin functionality.

As soon as I login, I want my user session to start unless I logout. While I am in my session, I want my respective Customer Portal username to be available as a global variable which can be used across all Visualforce pages. Is this possible?

 

I have made multiple Customer Portal users through SiteRegister visualforce page, but no matter which user logs in, current user is the default user and administrator of the force.com account. 

 

Can you please provide me a code through which after a user logs in, his session is maintained across all visualforce pages till he logs out. While he is logged in, the current user is the user who is logged and not the user of force.com developer account.

 

Pls. help!

Best Answer chosen by Admin (Salesforce Developers) 
MehaMeha

Registering a Site domain and Maintaining a Session

For all those people who want to register and free force.com site and maintain a session for users, I request you to first create a fresh developer.force.com account even if you have one and follow the following steps.

 

WORDS OF WISDOM

Instead of finding out why the problem is occurring in your existing portal and debugging it, create a new one and copy all your objects through workbench, copy and paste visualforce pages and apex classes to your new force.com account.

 

STEPS

  1. Customer Portal -> Settings -> Activate the portal, Enable Self Registration, Set Default New User License as Customer Portal Manager Standard, Set Default User Role as User and Default New User Profile as Customer Portal Manager Standard.
  2.  Create an Account and copy its Account ID
  3. Manage Users->Roles->Company size based sample-> Set up Roles->Either Add Role or Assign to existing role the above account created.
  4. Develop->Sites->Search availability and register a domain
  5. Edit the Site Details by providing name and other details. To start with keep the homepage as SiteLogin, Change Password as ChangePassword page and Profile Page as MyProfilePage.
  6. Activate the Site
  7. Click on Site Name and go to Login Settings->Edit->Select the customer portal so created
  8. Now the site is activated and login is enabled
  9. Go to SiteRegisterController page->Edit -> Replace the default PORTAL_ACCOUNT_ID with the above copied Account ID
  10. Go to MyProfileController->Edit->Comment the if condition which throws exception in case of Guest User.
  11. Go to SiteLoginController , change the return value of the login method with ‘return Page.MyProfilePage;’
  12. Go to Develop ->Sites->Click on Site URL
  13. If all the steps are done correctly, the Site will show hyperlinks for NewUser, ForgotPassword and Login on the Header as well as on the Output Panel.
  14. Click on New User, enter the details and on clicking submit you will be redirected to the Login page. Enter your username and password registered. If all the above steps are done correctly, you will be directed to the MyProfilePage which will show you the logged in user credentials alongwith change password button and a logout button.
  15. Copy paste the same URL on another browser or private browsing or incognito window and you will see the message of authentication required.
  16. If you click on Logout, you will be redirected to the login page again.

All Answers

MehaMeha

Registering a Site domain and Maintaining a Session

For all those people who want to register and free force.com site and maintain a session for users, I request you to first create a fresh developer.force.com account even if you have one and follow the following steps.

 

WORDS OF WISDOM

Instead of finding out why the problem is occurring in your existing portal and debugging it, create a new one and copy all your objects through workbench, copy and paste visualforce pages and apex classes to your new force.com account.

 

STEPS

  1. Customer Portal -> Settings -> Activate the portal, Enable Self Registration, Set Default New User License as Customer Portal Manager Standard, Set Default User Role as User and Default New User Profile as Customer Portal Manager Standard.
  2.  Create an Account and copy its Account ID
  3. Manage Users->Roles->Company size based sample-> Set up Roles->Either Add Role or Assign to existing role the above account created.
  4. Develop->Sites->Search availability and register a domain
  5. Edit the Site Details by providing name and other details. To start with keep the homepage as SiteLogin, Change Password as ChangePassword page and Profile Page as MyProfilePage.
  6. Activate the Site
  7. Click on Site Name and go to Login Settings->Edit->Select the customer portal so created
  8. Now the site is activated and login is enabled
  9. Go to SiteRegisterController page->Edit -> Replace the default PORTAL_ACCOUNT_ID with the above copied Account ID
  10. Go to MyProfileController->Edit->Comment the if condition which throws exception in case of Guest User.
  11. Go to SiteLoginController , change the return value of the login method with ‘return Page.MyProfilePage;’
  12. Go to Develop ->Sites->Click on Site URL
  13. If all the steps are done correctly, the Site will show hyperlinks for NewUser, ForgotPassword and Login on the Header as well as on the Output Panel.
  14. Click on New User, enter the details and on clicking submit you will be redirected to the Login page. Enter your username and password registered. If all the above steps are done correctly, you will be directed to the MyProfilePage which will show you the logged in user credentials alongwith change password button and a logout button.
  15. Copy paste the same URL on another browser or private browsing or incognito window and you will see the message of authentication required.
  16. If you click on Logout, you will be redirected to the login page again.
This was selected as the best answer
NishanNishan

Hi Meha,

              

                  I know your problem is solved. I just want to know what you mean by 'free domain'. Is it a trail version or something else?

 

                  I am new to site.com and I want to know the licensing options.

MehaMeha

Sorry for the delay  :(

 

Since you are new to this. You may find these links helpful:

http://login.salesforce.com/help/doc/en/salesforce_customer_portal_implementation_guide.pdf

http://login.salesforce.com/help/doc/en/salesforce_platform_portal_implementation_guide.pdf

 

Force.com Sites provides you the facility to register a website domain on cloud with log-in functionality. This feature is absolutely free but the limitation is you can only create a max of 5 customer portal users to log-in to your site. But you can maintain a session using cookies, if you wanted to learn without shedding a penny  :)But if you want to make a public site without log-in functionality, then you can make it accessible around the globe to n number of users.

To maintain a login session for each customer portal user, you have to purchase a license for a minimal cost. Pls note it does not come included even if you have purchased a sandbox. Further pricing and licensing detailing is mentioned in the pdf I just shared above.

 

If this post still didn't answer your question, feel free to ask again by specifying what exactly I missed to answer :)

Have a nice day ! 

NishanNishan

Hi Meha,

                Thank you for replying. Your answer was exactly what I asked for. I wanted to build a website with almost 120 login users. So it appears  I will have to pay for it for Site.com.  I use Force.com and thats how I came to these boards.