Jump to content

Frontend password reset


Recommended Posts

I just published a pre-release of my new password reset module. It will enable identification from any field of your choice, and is fully translatable.

Integration is just 2 lines of code, the first is calling the controller, the second is loading a script (no dependencies).

You can download the code on GitHub at https://github.com/plauclair/PasswordReset.

Also, have a look at the reset process in this video https://vid.me/eEVY.  This exemple is not styled, but there should be all you need in there to style it.

Comments and feature requests very welcome!

  • Like 12
Link to comment
Share on other sites

this is great - last project we needed this on we did something like this, which worked ok:

<?php
if($notices->count) {
	echo '<ul id="notices">';	
		foreach($notices as $notice) {
	  		echo "<li>$notice->text</li>";
		}
	echo '</ul>';
} else {
	echo "<div class='form-container'>";
		$controller = new ProcessController();
		$controller->setProcessName('ProcessForgotPassword');
		echo $controller->execute();
	echo "</div>";
		
}

one problem i noticed was the link in plaintext was breaking, so wasn't clickable, i was thinking that it would be good if the email could be sent in html where the link could be in an anchor tag

Link to comment
Share on other sites

Great module...i like it.

Tested here with two different Mail Clients and RoundCube online....all works like a charm.

Put this in the module directory if you are ready....very good extension.

Best regards mr-fan

Link to comment
Share on other sites

Thanks guys.

@mr-fan it needs to be production ready this week so for sure it's going to be there pretty soon.

@jacmaes yes currently there is a length check in the module properties. There will be a strength check at some point, but probably not at v.1.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hey I've been wondering if any of you who are currently using this in production or testing have any feedback? I want to do a proper release soon, and I'd love your input! Cheers!

I just put this to use on a site, because I realized the core password reset module does not have good user experience. It is too much to expect a user to keep their tab open after clicking submit or that they have to do the reset on the same device. So thanks for this traditional reset module!

Link to comment
Share on other sites

  • 5 months later...

Thanks for this module, Pierre-Luc.

I get a couple of errors when using it.

When assigning the template "password-reset" to a page or attempting to edit a page with the template assigned I get:

ProcessWire: ProcessPageEdit: Unknown template

Edit: this error seems to be caused by a conflict between Password Reset and the Batch Child Editor module. After uninstalling Batch Child Editor the error message is not shown.

And when viewing a page with this template assigned on the frontend I get:

Notice: Trying to get property of non-object in ...\site\modules\PasswordReset\PasswordReset.module on line 32

Looking at line 32 maybe this error is because my site is not multi-language?

Link to comment
Share on other sites

The unknown template error is due to a bug in the settings for the password-reset template.

67 password-reset 121 0 0 {"childTemplates":[120]

There is no template with an id of 120 in my system. 120 refers to the fieldgroup for the password-reset-request template, rather than the id of that template itself. This is the culprit: https://github.com/plauclair/PasswordReset/blob/master/PasswordReset.module#L279

That said, I have added an additional check to BatchChildEditor so the error won't occur. I am currently working on some other changes to BCE so I won't commit this fix just yet, but you can do it yourself by changing:

https://github.com/adrianbj/BatchChildEditor/blob/master/BatchChildEditor.module#L711

if(!$this->isAllowedTemplateAdd($templateId, $pp)) continue;

to:

if(!$t->id || !$this->isAllowedTemplateAdd($t, $pp)) continue;
  • Like 1
Link to comment
Share on other sites

I think all you need to do is change:

$passwordResetTemplate->childTemplates = [$requestFieldgroup->id];

to:

$passwordResetTemplate->childTemplates = [$requestTemplate->id];

but maybe there is something more to it that I have overlooked.

Link to comment
Share on other sites

Most probably. When you said it was referencing the fieldset I knew something else was fishy.


By the way I know from the GitHub stats that a few of you use the module. Is it working as expected, do you think I should provide a default stylesheet? I'd really like some feedback on the direction to go with.

Link to comment
Share on other sites

  • 6 months later...

@Pierre-Luc Thank you for your module! Please keep it going. Here are my wishes for the development roadmap.

  1. Make it possible to fully customize the markup. Maybe with some kind of template overrides or something. I think there is no need for anything default, rather an easy way to make it your own.
  2. Ajax would be a good option.
  3. A bit more docs would help. I did experience some bugs when using it with installation having users with multiple templates. It took some time to figure out that I should configure the passwordResetUser field to use multiple templates.

And there should be a 1.0.0 version in the module directory, of course. I did check it on 3.x - seems to work fine.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I'm getting the following error on PW 3.045:

 

Error: Uncaught Error: Call to a member function of() on boolean in /home/my-domain/public_html/site/modules/PasswordReset/PasswordReset.module:187
Stack trace:
#0 /home/my-domain/public_html/site/modules/PasswordReset/PasswordReset.module(235): PasswordReset->resetPassword()
#1 /home/my-domain/public_html/site/templates/password-reset.php(3): PasswordReset->controller()
#2 /home/my-domain/public_html/wire/core/TemplateFile.php(268): require('/home/my-domain...')
#3 /home/my-domain/public_html/wire/core/Wire.php(374): ProcessWire\TemplateFile->___render()
#4 /home/my-domain/public_html/wire/core/WireHooks.php(682): ProcessWire\Wire->_callMethod('___render', Array)
#5 /home/my-domain/public_html/wire/core/Wire.php(402): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
#6 /home/my-domain/public_html/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) (línea 187 de /home/my-domain/public_html/site/modules/PasswordReset/PasswordReset.module) 

 

Link to comment
Share on other sites

  • 3 years later...

I have to come up with a 'forgot password' feature for my custom login/register process. I hoped I could just use the core module ProcessForgotPassword, but see it hasn't been updated since 2012 and it is not clear to me how to use it.

How do I add ProcessForgotPassword to my login form/template? The module is installed in the backend, but then what? Are there instructions anywhere?

Is @Pierre-Luc's module safe to use for the latest Processwire versions? What/where is the latest version? Is anyone else using it with improvements?

Are there other solutions/modules?

I'll probably work on this next weekend and post more findings. 

Link to comment
Share on other sites

Folks, Pete and I have a solution for the most commonly encountered password reset/login feature requests encountered across various large-scale membership sites we've worked on, including feedback from a site with ~40k users.

We are polishing it up at the moment and will announce more in the next couple of days.

  • Like 9
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...