0

I recreated the login page with a visualforce page. Here is the site:

https://rockpool.force.com/portal

To reproduce the issue: 1. go to the site and click Forgot Password 2. type something in and click submit

It will then go to this url: /ForgotPasswordConfirm

But the page that is displayed is this url: /portal (the login page again)

Sometimes this doesn't happen and the correct page is displayed (forgotpasswordconfirm).

Here is what I have for the forgot password logic:

public with sharing class ForgotPasswordController {
public String username {get; set;}   

public ForgotPasswordController() {}

public PageReference forgotPassword() {
    boolean success = Site.forgotPassword(username);

    PageReference redirect = new PageReference('/apex/ForgotPasswordConfirm'); 
    redirect.setRedirect(true); 

    return redirect;
}

public PageReference cancel() 
{
    PageReference redirect = new PageReference('/apex/Portal'); 
    redirect.setRedirect(true); 

    return redirect;
}

}

And here is the markup for the forgot password confrim page:

<apex:page showHeader="false" title="{!$Label.site.forgot_password_confirmation}">

#wrap {display:table;height:100%} </style> </script>

<style>
* {
    margin: 0;
    padding: 0;
}
body {
    width: 100%;
    background: linear-gradient(180deg, #AEB3B7 50%, #94999F 50%);
}
#form_login {
    left: 50%;
    top: 50%;
    position: absolute;
    -webkit-transform: translate3d(-50%, -50%, 0);
    -moz-transform: translate3d(-50%, -50%, 0);
    transform: translate3d(-50%, -50%, 0);
    //width:550px;
    width: 315px;
    padding: 25px;
    background-color:white;
    box-shadow: 10px 10px 5px #66696E;
    border-radius: 25px;
}
@media all and (max-height: 430px) {
    .slds #formAndFishContainer {
        margin-top:60px;
    }
}
</style>
</head>
<body>
<div class="slds">
    <div id="main" style="width:auto;">
        <c:LoginCommunityHeader />
           <div id="form_login">
              <apex:outputText style="color:black;" value="{!$Label.site.temp_password_sent}"/>
            </div>

So if I just go to: https://rockpool.force.com/forgotpasswordConfirm

I get the login screen even though that is not what should be displayed for the forgotpasswordconfirm page. Does anyone know why?

EDIT

Here is the forgot password submit page:

<apex:page docType="html-5.0" showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="false" applyBodyTag="false" id="forgotPassword" controller="ForgotPasswordController" title="{!$Label.site.forgot_password}">
<html>
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
      <apex:stylesheet value="{!URLFOR($Resource.SLDS103, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
      <apex:stylesheet value="{!$Resource.Community_Style}"/>
      <apex:includeScript value="{!$Resource.Community_JS}"/>
      <!--[if !IE 7]>
        <style type="text/css">
            #wrap {display:table;height:100%}
        </style>
      <![endif]-->
      <!--[if lt IE 9]>
          <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
      <![endif]-->

          <style>
* {
    margin: 0;
    padding: 0;
}
body {
    width: 100%;
    background: linear-gradient(180deg, #AEB3B7 50%, #94999F 50%);
}
#formAndFishContainer {
    left: 50%;
    top: 50%;
    position: absolute;
    -webkit-transform: translate3d(-50%, -50%, 0);
    -moz-transform: translate3d(-50%, -50%, 0);
    transform: translate3d(-50%, -50%, 0);
    width:550px;
}
#form_login {
    width: 370px;
    padding: 25px;
    background-color:white;
    box-shadow: 10px 10px 5px #66696E;
    border-radius: 25px;
    margin-left:85px;
}
.slds .loginTitle {
    font-size:27px;
    font-weight:bold;
}
.slds .loginTextBox {
    width:100%;
    -moz-border-radius: 15px;
    border-radius: 15px;
    border:solid 1px #94999F; 
    padding:5px;
    margin-bottom:10px;
    margin-top:10px;
}
.slds .loginButton {
    width:100%;
    -moz-border-radius: 15px;
    border-radius: 15px;
    border:solid 1px #94999F; 
    padding:5px;
    margin-bottom:10px;
    margin-top:10px;
    background-color:#99092D;
    color:white;
    text-transform: uppercase;
}
.slds .fish {
    float:right;
    margin-top:165px;
}
</style>
</head>
<body>
  <div class="slds">
    <div id="main" style="width:auto;">
      <c:LoginCommunityHeader />

      <div id="formAndFishContainer">
            <div id="form_login" style="float:left;">
              <h1 class="loginTitle">Forgotten Password</h1>
              <apex:outputText styleClass="title" value="{!$Label.site.enter_password}"/>
              <apex:form id="theForm">
                  <apex:pageMessages id="error"/>
                  <apex:panelGrid columns="3" style="margin-top:1em;">
                  <apex:inputText required="true" id="username" value="{!username}" html-placeholder="Username" styleClass="loginTextBox"/>
                  <apex:commandButton id="submit" value="{!$Label.site.submit}" action="{!forgotPassword}" styleClass="loginButton"/>
                  </apex:panelGrid>

              </apex:form>
              <apex:form >
              <center><apex:commandLink action="{!cancel}">Cancel</apex:commandLink></center>
              </apex:form> 
            </div>
    </div>         
     </div>
   </div>                  
 </body>
 </html>             

6
  • the redirect seem to be working fine when i click the forgot password on your portal and cancel brings it back to the login page.
    – Rao
    Oct 26 '16 at 20:41
  • yes that part works but when you click forgot password and then type in a fake email such as test@test.com it redirects back to the login page instead of the confirm page.
    – Joe Bauer
    Oct 26 '16 at 20:50
  • I think the issue is a guest access issue, whenever I go to any page without logging in first it redirects me back to the login screen. But in this case I want it to go to the confirmation page saying that you should receive an email with instructions to reset your password. Instead it goes back to the login screen.
    – Joe Bauer
    Oct 26 '16 at 20:51
  • Also, I added the ForgotPAsswordConfirm page to enabled visualforce page access on the site for the community and that didn't fix it.
    – Joe Bauer
    Oct 26 '16 at 20:57
  • can you post your submit controller and VF page code, as far as i can see from the resulting html for submit there is no event defined. Your submit redirect could be an issue.
    – Rao
    Oct 26 '16 at 21:00
0

@Joe, The controller class has a redirect for success scenario and not for fail. If the fail clause is handled before the final return, then you can add some comment on the same page to show an error/information msg on this same page. This link has some insights too: Forgot password page on visualforce

1
  • there isn't a controller for the forgotPasswordConfirm page
    – Joe Bauer
    Oct 28 '16 at 20:36
0

So I did everything correctly, and even checked to make sure the API version was up to date. Nothing worked. I created a new page with the exact same markup and it works just fine. Must be a Salesforce glitch.

2
  • Sometime changes you make to site/portal pages do not propagate immediately. not sure if that was a part of your issue or not but keep it in mind for future.
    – Eric
    Oct 28 '16 at 22:40
  • yeah i thought about that too, but it was over a week and still not working
    – Joe Bauer
    Oct 31 '16 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.