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
akousikaakousika 

Custamer Portal login with 2 profile using 1 login screen need help

Hello every one , I have the a problem , i need to login the customer portal user's with single login screen with out radio buttons, currently i am using 2 radio buttons for 2 different profile's to differentiate them below is the current image . Image and video hosting by TinyPiccan any one help me on this this is very urgent Please help me As soon as possible Regards, Adithya k
sravusravu

Hi,

 

Do you want the user to login to the portal or to your site? By looking at the image i am little bit confused if you are trying to login to the site or portal. What is the type of the license you are giving to the users.

 

As per my understanding every time the user logins, based on the radio button you need to update the profile of the user.

akousikaakousika

Hi sravu,

 

Thanks for reply,

 

currently i am using 2 radio buttons for 2  different profile's (Investor & Adviser ) , back end i am deferentiating 2 profile id's by radio buttens , actually this login screen is for customer portal users , and the type of the licence is "Authenticated Website" 

it is working fine but ,  My client wants to remove the radio buttens he wants to login based on email id nuthing but user name .

 

currently this is the below code

 

  <form name="login" action="https://tapp0.salesforce.com/secur/login_portal.jsp" method="POST" base_target="_top">                                           <table width="50%" border="0" align="center" cellspacing="0" cellpadding="0">            

 <tr>            

<td height="20" align="left" valign="middle">&nbsp;</td>    

       <td align="left" valign="middle"> <input type="hidden" name="startURL" value=""/>          

            <input type="hidden" name="loginURL" value="" />  

 <input type="hidden" name="useSecure" value="true" />            

           <input type="hidden" name="orgId" value="00DT0000000HEx0" /></td>      

     <td align="left" valign="middle">&nbsp;</td>    

     </tr>    

      <tr>    

       <td height="20" align="left" valign="middle">&nbsp;</td> 

           <td align="left" valign="middle">  <input checked="true" type="radio" id="portalId" name="portalId" value="060400000008v37" /> Investor &nbsp;&nbsp;          

             <input type="radio" id="portalId" name="portalId" value="060400000008v32" /> Advisor  <input type="hidden" name="loginType" value="3" />        

               <input type="hidden" name="action" value="loginAction" />

</td>      

     <td align="left" valign="middle">&nbsp;</td>      

   </tr>  

       <tr>    

       <td width="32%" height="30" align="left" valign="middle"><strong>User Name :</strong>

</td>      

     <td width="51%" align="left" valign="middle">

<input type="text" class="textfield" id="username" name="un"/>

</td>    

       <td width="17%" align="left" valign="middle">&nbsp;</td>  

       </tr>      

   <tr>      

     <td height="30" align="left" valign="middle"><strong>Password :</strong></td>      

     <td align="left" valign="middle"><input type="password" class="textfield" id="password" name="pw" /></td>        

   <td align="left" valign="middle">&nbsp;</td>      

   </tr>      

   <tr>      

     <td height="30" align="left" valign="middle">&nbsp;</td>        

   <td align="left" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">  

       <tr>        

   <td align="left" valign="middle"><input name="" type="checkbox" value="" /> Remember Me Next Time</td>    

       <td align="right" valign="middle" class="signup">

<a href="HowToInvest">Sign Up</a></td>

          </tr>    

   </table>  

     </td>      

     <td align="left" valign="middle">&nbsp;</td>        

 </tr>        

 <tr>        

   <td height="30" align="left" valign="middle">&nbsp;</td>    

       <td align="left" valign="bottom"> 

            <input type="image" src="{!URLFOR($Resource.LOGINBUTTON)}" alt="Submit" onClick="return validate();" />       

    </td>      

     <td align="left" valign="middle">&nbsp;</td>    

     </tr>        

 <tr>      

     <td height="20" align="left" valign="middle">&nbsp;</td>    

       <td align="left" valign="middle">&nbsp;</td>        

   <td align="left" valign="middle">&nbsp;</td>    

     </tr>            

     </table>

</form>

 

 

 

This will be help full to me if u solve this problum

 

Thanks 

Adithya 

sravusravu

Hi,

 

I am not clear with your requirement. Could you please answer my questions:

 

1. Does your users land in different pages based on their profile?

2. Does your user's profile keep changing in any of the cases?

3. If the users with advisor and investor profile land in same page when they login, then you don't need to login based on the profile.

4.Does your users have more than one username with different profiles?/* I am not clear of this requirement*/

 

But one thing you will be having a sitelogincontroller where in your login method id called.

 

Thanks.

 

akousikaakousika

Hi,

 

Actually  

 

1. Does your users land in different pages based on their profile? Yes

2. Does your user's profile keep changing in any of the cases? No

3. If the users with advisor and investor profile land in same page when they login, then you don't need to login based on the profile.

No they will never land in same Login page

4.Does your users have more than one username with different profiles?/* I am not clear of this requirement*/

 

in this requirement One user have only one profile (Invester/Adviser).He dont have different profile's

 

 

Thanks

Adithya

Pradeep_NavatarPradeep_Navatar

Use SOQL query to get profile id and associate with the user properties :

 

     Profile p = [select id,name from Profile where];

     User u= new User();

     u.profileId= p.id;

     // other user information.

sravusravu

Change your sitelogincontroller as follows

 

/**
 * An apex page controller that exposes the site login functionality
 */
global class SiteLoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        User u = [select ProfileId from user where Username = :username];
        if(ProfileId=='/* Id of the profile Investor */')
        {
            return Site.login(username, password, /*startURL for the Investor profile users to land in */');
        }
        else if(ProfileId=='/* Id of the profile Advisor */'){
            return Site.login(username, password, /*startURL for the Advisor profile users to land in */');
        }
        else
        {
           /* perform any other action if needed*/
        }
     }    
}

 

Let me know if you face any difficulty................

akousikaakousika

Hi sravu,

 

Thanks for the replay

 

sorry for the delay I got High fiver I took leave for 4 days lets come to the topic

I tried by keeping 

 

global class SiteLoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        User u = [select ProfileId from user where Username = :username];
        if(ProfileId=='060400000008v37')
        {
            return Site.login(username, password,' https://cs3.salesforce.com/secur/login_portal.jsp?orgId=00DQ0000000C4PG&portalId=060400000008v37');
        }
        else if(ProfileId=='060400000008v32'){
            return Site.login(username, password, 'https://cs3.salesforce.com/secur/login_portal.jsp?orgId=00DQ0000000C4PG&portalId=060400000008v32');
        }
        
     }    
}

 

It is not loging in to the portal & their is no errors , the same login page is displaying . 

 

Pleaase Help me  thanks in advance .

 

Adithya 

 

 

 

sravusravu

Ok, I figured out the problem with the login method,

 

in the method site.login(), you are passing the username, password and the portal login URL. This is the reason why it is taking you to the same login page. The start URL will be the page that the user will land in after he login to the site.

 

the startURL will be the current page URL that user should land in.

 

For example, if the user  with profile investor has to land in a page called testpage after he logins to the site, you should pass the parameters in the method as follows,

 

site.login(username,password,'/apex/testpage');

 

or else before passing the parameter you set the startURL as follows:

 

startURL = '/apex/testpage';

site.login(username,password,startURL);

Ryan-GuestRyan-Guest

cs3.salesforce.com is the domain for the non-sites page. You'd want to point to your site, not salesforce.com

akousikaakousika

Thanks for the replay

 

below is the controller code

 

currently i am using 3 profiles  i am calling the methods saparately as shown below the problum hear is i am unable to login to the portal

 

currect 'cs3.salesforce.com' is the domain for the non-sites page. it is the domain of customer portal ,  i am trying to point out to the customer portal using salesforce.com pages .

 

below is the My page and controller

 

page

_____________

 

<apex:page showHeader="false" title="KBR Capital Partners" controller="kbrLogin" id="page">
<apex:includeScript value="{!$Resource.commonjs}"/>

        <h1> Investor / Advisor Login</h1>
   

<apex:pageBlock id="pblock">

  
               <apex:form id="form">  
            
                      UserName: 
                 <apex:inputText value="{!username}" id="username1"/>
                   
                        Password:

                       <apex:inputText value="{!Password}" id="username12"/>
                        
                <input type="image" src="{!URLFOR($Resource.LOGINBUTTON)}" id="Login1"  onclick="{!login}"/>
          
              </apex:form> 
  </apex:pageBlock>
  </apex:page>

 

 

------------------------------------------------------------------------------------------------------------------------------

controller

______________

 

global class kbrLogin {

    global String username {get; set;}
    global String password {get; set;}

    global void getlogin() {
    try{
       User u = [select ProfileId,username,Profile.Name from user where Username = :username];
        system.debug('..........................out of if..................................'+u.Profile.Name);
       if(u.Profile.Name == 'Investor'){
        system.debug('.........................in if.................................'+u.Profile.Name);
       invlogin();
       }
       if(u.Profile.Name == 'Advisor'){
           advlogin();
       }
        if(u.Profile.Name == 'Authenticated Website Clone'){
           AWClogin();
       }
      
   }catch(Exception e)
    {
   
    }
   }
  
      global PageReference AWClogin()  
       {
      
      
        // String startUrl = 'https://cs3.salesforce.com/secur/login_portal.jsp?orgId=00DQ0000000C4PG&portalId=060Q00000004cMI';
       
        String startUrl = ' /apex/HomePage ';
       
          system.debug('..........................username.....3..................................'+username);
           // system.debug('..........................password....3...................................'+password);
      //  system.debug('........................................3.........................'+Site.login(username, password, startUrl));
       
    return Site.login(username, password, startUrl);
      
       }
  
    global PageReference advlogin() {
   
        String startUrl = 'https://cs3.salesforce.com/secur/login_portal.jsp?orgId=00DQ0000000C4PG&portalId=060400000008v32';
          system.debug('..........................username.....1..................................'+username);
           // system.debug('..........................password....1...................................'+password);
        system.debug('........................................1.........................'+Site.login(username, password, startUrl));
       
       // site.login(username,password,'https://cs3.salesforce.com/secur/login_portal.jsp?orgId=00DQ0000000C4PG&portalId=060400000008v32');
       return Site.login(username, password, startUrl);
    }
   
    global PageReference invlogin() {
           String startUrl = 'https://cs3.salesforce.com/secur/login_portal.jsp?orgId=00DQ0000000C4PG&portalId=060400000008v37';
              system.debug('..........................username..2.....................................'+username);
            system.debug('..........................password....2...................................'+password);
          //  system.debug('......................................2...........................'+Site.login(username, password,startUrl));
           // site.login(username,password,'https://cs3.salesforce.com/secur/login_portal.jsp?orgId=00DQ0000000C4PG&portalId=060400000008v37');
           return Site.login(username, password, startUrl);   
    }   
        global kbrLogin () {
       
        getlogin();
        }
   
    global static testMethod void testSiteLoginController () {
        // Instantiate a new controller with all parameters in the page
        SiteLoginController controller = new SiteLoginController ();
        controller.username = 'nakumar@aw.com';
        controller.password = 'force123';
               
        System.assertEquals(controller.login(),null);                          
    }  
}

Jeffrey EhrhartJeffrey Ehrhart
This standard profile lets users view and edit data they directly own or data owned by or shared with users below them in the Customer Portal role hierarchy. These users can also view and edit cases where they are listed in the Contact Name field.
From Setup, in the Quick Find box, enter Users , and then select Users.
Click the user that you want to give permissions to.
Under Permission Set Assignments, click Edit Assignments.
Under Available Permission Sets, select Financial Services Community User, and then click (https://inloggengids.com/) Add.