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
Btuitasi1Btuitasi1 

Code not locking down page

I have a page on my Force.com page that doesn't seem to be locking down based on my custom login. This is the only page that is accessible without going through the login process. Here is my code:
 
public with sharing class topIdeaExt {
           
    public List<Idea> getRecent2()
    {
        return [SELECT Id, Title, CreatedBy.Name, Voting_Status__c, CreatedDate, VoteTotal FROM Idea WHERE Voting_Status__c = 'Active' order by createdDate desc Limit 10];
    }
    public List<Idea> getMostVoted2()
    {
        return [SELECT Id, Title, CreatedBy.Name, Voting_Status__c, CreatedDate, VoteTotal FROM Idea WHERE Voting_Status__c = 'Active' order by VoteTotal desc, CreatedDate desc Limit 10];
    }
    public List<AggregateResult> getTop6Contributors()
    {
        return [SELECT CreatedById, CreatedBy.Name Name  FROM Idea group by CreatedById, CreatedBy.Name order by count(CreatedById) desc limit 6];
    }
    
    public topIdeaExt() {}
      // Code we will invoke on page load.
    public PageReference forwardToCustomAuthPage() {
        if(UserInfo.getUserType() == 'Guest'){
            return new PageReference('CostCenter/CostCenterLogin');
        }
        else{
            return null;
        }
    }
}

Any idea how I can fix this issue?

Thanks!
James LoghryJames Loghry
Hard to tell what's going on exactly, but:
  1. How is the forwardToCustomAuthPage method getting invoked?  Are you calling via the apex:page action attribute?  
  2. Have you added System.debugs to see what UserInfo.getUserType() is returning?  Could be that it's using your existing Salesforce login if you're not careful.
  3. Is the CostCenter/CostCenterLogin URL correct?