EllisLab text mark
Advanced Search
     
Forgot Password Template
Posted: 30 November 2008 01:18 PM
Avatar
Joined: 2005-12-21
399 posts

I am trying to incorporate my site design into the ‘Forgotten Password’ template.  I’ve noticed that this is quite a bit more involved than I originally thought.  Will this require me to change ALL member templates as well?  It seems like the for. pass. template automatically pulls in the same header that is used on the other member templates.

Am I correct in this?

 Signature 

EE v. 2.6.1 (Build: 20130506) |  DF v. 3.1.8 (Build: 20120507)

 
Posted: 01 December 2008 08:11 AM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-10-17
297 posts

This may be a stupid question, but why are you incorporating your template into the forgotten password template, why not the other way around and simply dump the following form in your template:

<form id='forgot_password_form' method="post" action="http://YOUR URL/index.php"  >
                            <
div class='hiddenFields'>
                                <
input type="hidden" name="XID" value="{XID_HASH}" />
                                <
input type="hidden" name="ACT" value="11" />
                                <
input type="hidden" name="RET" value="-3" />
                                <
input type="hidden" name="FROM" value="" />
                                <
input type="hidden" name="site_id" value="1" />
                            </
div>
                            <
fieldset>
                                <
legend>Please enter your login details:</legend>
                                <
label for="email">Email</label><input id="email" name="email" value="" maxlength="100" type="text" title="Please enter the email address that you registered with." class="required email" /><br />
                                <
button class="submitButn" type="submit" name="submit" value="Submit form">Submit</button>
                            </
fieldset>
                        </
form

I gave up trying to incorporate stuff into the built-in templates, as there were always bits that wouldn’t work (mainly this was in message templates, etc).

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

 
Posted: 01 December 2008 10:24 AM   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2005-12-21
399 posts

So, you’re saying to just create my own, new template within my site templates and name it something like “forgot_password”, then dump the code example you provided into my template, and not even worry with the member templates?

If that is what you’re saying, I didn’t even know you could do that.

 Signature 

EE v. 2.6.1 (Build: 20130506) |  DF v. 3.1.8 (Build: 20120507)

 
Posted: 01 December 2008 10:30 AM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2007-10-17
297 posts

Yep.

I’ve got a custom login form here: http://www.avabooks.ch/index.php/ava/login which has a link to the forgotten password page.

Then http://www.avabooks.ch/index.php/ava/resetpassword is the form above.

Neither of these use the membership templates.

Peter.

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

 
Posted: 01 December 2008 10:36 AM   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2005-12-21
399 posts

It does seem a lot simpler to just create your own templates than to work around what EE has provided.  That’s what my original post was all about.

Thanks for the info!

 Signature 

EE v. 2.6.1 (Build: 20130506) |  DF v. 3.1.8 (Build: 20120507)

 
Posted: 24 June 2010 05:20 AM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-20
190 posts

@Twobelowzero - how did you deal with the password reset function and not showing the EE CP? I think there were some redirects in there, but it was so quick I didn’t catch it - I didn’t see anything EE branded, which is what I need to do too…

Thanks,


Edit - I think I’ve figured it - using the custom forgotten password form uses my user message templates automagically… Now to deal with the missing index.php from the reset link…

 Signature 

“Dude,I totally Swayze’d that mother.”
Project 14

 
Posted: 24 June 2010 06:20 AM   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2007-10-17
297 posts

Hi Luc,

I usually send the form via Ajax, so it’s seamless.

I’m using the JQuery validation plugin but you could call the SubmitPasswordReset() function directly on the form submit button…

Here’s the JavaScript for the validation trigger and Ajax call:

//###   RESET PASSWORD   ###
    
$("#forgot-password-form").validate({
        submitHandler
: function(form{
            
//###   Disable the Submit button   ###
            
$("#forgot-password-form button").fadeTo("slow"0.20).attr("disabled","disabled");

            
SubmitPasswordReset();
            return 
false;
        
}
    }
);

//###   RESET PASSWORD FORM SUBMISSION   ###
function SubmitPasswordReset() {
    
//###   Send form via AJAX   ###
    
$.ajax({
        type
"POST",
        
data: $("#forgot-password-form").serialize() + "&action;=" + $("#forgot-password-form").attr("action"),
        
dataType"html",
        
success: function (html{
            
//###   Successfully received an html page from the server   ###
            
if ( html.search(/error/i) >= {
                
if (html.search(/not found/i) >= 0{
                    
$("#pwd-reset-email").addClass('error');
                    $(
"#pwd-reset-email").after('<label class="error" for="login-username" generated="true">Email address doesn\'t exist<br />Re-check or register an account</label>');

                } else if (html.search(/already logged in/i) >= 0) {
                    $("#forgot-password-form button").after('
<label class="error" for="login-username" generated="true">User already logged in!</label>');

                } else if (html.search(/account has not been activated yet/i) >= 0) {
                    $("#forgot-password-form button").after('
<label class="error" for="login-username" generated="true">Account has not been activated yet<br />Check your email and activate</label>');

                } else {
                }

                $("#forgot-password-form button").fadeTo("slow", 1).removeAttr("disabled");

            } else {
                //###   Successfully sent reset request   ###
                //"Instructions for resetting your password have just been emailed to you."
                $("#forgot-password-form").hide();
                $("#password_reminder .form-success").slideDown("slow");

                //###   Show/hide user nav links   ###
                ClearForm("#forgot-password-form");

                //###   Close PrettyPhoto Popup Window   ###
                var currentURL = new Array();
                currentURL = top.location.href.split('
#');
                
top.location.href currentURL[0] "#close-pp-delay";
            
}
        }
,
        
error: function (XMLHttpRequesttextStatuserrorThrown{
            
//###   Error occurred, could be server, CMS or 404   ###
            //alert(textStatus + errorThrown);
            
$("#forgot-password-form button").fadeTo("slow"1).removeAttr("disabled")
        
},
        
complete: function (XMLHttpRequesttextStatus{
            
//alert(textStatus);
        
}
    })
;
//###   End of SubmitLogin function   ### 

Note the checks in there for the various errors from EE.

I can’t recall what I did for the AVA site or what the above does without JavaScript - think the EE panel will appear, which I’ve customised to give it some branding.

Hope this is helpful.

Peter

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)