You need to sign in to do that
Don't have an account?
B2000
Custom Portal Login Page Using login_portal.jsp
I am using Sites to create a custom VF portal login page. The custom VF portal login page works except when an invalid username and/or password is submitted. When an invalid username and/or password is submitted, the default SF portal login page is displayed and not the current custom VF portal login page. Is there a parameter that can be passed to the login_portal.jsp to redirect to the current custom VF portal login page. Here is the current code:
Global pageReference login() { String startURL = 'https://naX.salesforce.com/secur/login_portal.jsp'; startURL += '?orgId=00Dxxxxxxxxxxx&portalId=060xxxxxxxxxx&loginType=3'; startURL += '&startURL='; startURL += '&loginURL='; startURL += '&useSecure=true'; startURL += '&un=' + username; startURL += '&pw='+ password; startURL += '&retURL=http://npifinancial.force.com/SmartSpend'; pageReference p = new PageReference(startURL); p.setredirect(true); return p; }
Unfortunately that didn't work. Here is the solution that worked for me.
If a valid PageReference is returned when calling the site.login, then there was a successful login.
Redirect to the portal.jsp.
Otherwise redirect back to the site login page.
All Answers
In a similar type of application, i have developed customer portal login functionality by using component and visual force page. It works fine when i give invalid password/Username , it gives site generated message.
I have used site.login(username.password,starturl) method in apex and shown the message as an alert in component.
Unfortunately that didn't work. Here is the solution that worked for me.
If a valid PageReference is returned when calling the site.login, then there was a successful login.
Redirect to the portal.jsp.
Otherwise redirect back to the site login page.
Could someone post what the basic VF page would look like to capture the username and password, and also the call that would pass those into the controller?
how do we customize the login page of customer portal . we are not using sites .
can we give a dynamic logic message ?
Which, as you can see, is basically a copy&paste of the OP's code.
However, the (p == null) portion seems to evaluate to "true" even when the login is successful, sending me back to my custom login page.
As experiment, I replaced everything after //if login==false with a return to portalPage, and it simply redirected to the default login page on a failed login and into the actual portal on a successful login.
I'm not sure what's making my code different from the OP's code, and would appreciate it if anyone could help me out with some advise. Thanks.