Jump to content
Pierre-Luc

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

:)

I really want to push the usability side of this one. If you've found other shortcomings of ForgotPassword that would like to be improved, let me know. We used to use ProcessForgotPassword too but it's not working that great for us.

Share this post


Link to post
Share on other sites

@Macrura -- Did the url break in PW's reset module or mine? Also what messaging client (if any)?

Share this post


Link to post
Share on other sites

sorry - i meant PW reset has hardcoded message that sends plaintext; the url was breaking in Outlook for Mac, i think some newer email clients don't break the URL

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi Pierre-Luc,

Looks great! is there a check for a minimum number of characters?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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!

  • Like 1

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks Adrian, I'll look if there are other side effects and better ways to fix this one and commit something by this weekend. :)

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
Share on other sites

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) 

 

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi @modifiedcontent, yes, it's now all packaged up as a module and currently in testing. I posted about it here. Please be aware, as mentioned in that post, Pete and I intend to release this as a commercial module sometime this week.

Share this post


Link to post
Share on other sites

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Cybermano
      Food Allergens Module
      A simple List of Food Allergens
      My needs were to provide a simple list of food allergens for our clients with restaurant related activity.
      The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window.
      This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea.
      This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens.
      ---
      Main features
      The basis
      All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard
      First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module).
      Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list).
      A step further
      With the tips of  @bernhard, @Soma (and many others), see here , the magic happens. 
      The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list.
      A little further
      Why scroll to the top of the page to click a link?
      The next step was to create a sticky button only in the food menu pages.
      Again with a @bernhard tip I moved into the customization of this simple module and the related hook.
      ---
      How to use this module
      After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page
      Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM):
      View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the  asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens".
      At the same way, the option for the sticky button, but with a plus
      The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>.

      Video Explanation
      In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call.
      This because I've set a specific one for each allergen to show up a tooltip in the front end.

      Registrazione #33.mp4  

      Registrazione #34.mp4 ---
      Last but not the least
      Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible.
      I always learn a lot here, so I would share my code for whom it could be interested.
      I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module.
      Obviously you are free to modify the code as per your needs.
      Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). 😉
      I hope be helpful or for inspiration.
      Bye
      ready.phpList-ITA.htmlList-ENG.htmlAllergens.module
      README.md
    • By Robin S
      This module is sort of an upgrade to my earlier ImageToMarkdown module, and might be useful to anyone working with Markdown in ProcessWire.
      Copy Markdown
      Adds icons to images and files that allow you to copy a Markdown string to the clipboard. When you click the icon a message at the top left of the screen notifies you that the copying has occurred.
      Screencast

      Note: in the screencast an EasyMDE inputfield is used to preview the Markdown. It's not required to use EasyMDE - an ordinary textarea field could be used.
      Usage: Images
      When you hover on an item in an Images field an asterisk icon appears on the thumbnail. Click the icon to copy an image Markdown string to clipboard. If the "Description" field is populated it is used as the alt text.
      You can also open the "Variations" modal for an image and click the asterisk icon to copy an image Markdown string for an individual variation.
      Usage: Files
      When you hover on an item in a Files field an asterisk icon appears next to the filename. Click the icon to copy a link Markdown string to the clipboard. If the "Description" field is populated it is used as the link text, otherwise the filename is used.
       
      https://github.com/Toutouwai/CopyMarkdown
      https://processwire.com/modules/copy-markdown/
    • By BitPoet
      I've realized that I've been jumping back and forth between the PW API docs and the source code for site modules far too much. The idea to hold all necessary documentation locally in one place has occurred to me before, but getting PHPDocumentor et al set up and running reliably (and producing readable output) as always been too much of a hassle. Today I was asked how I find the right hooks and their arguments, and that inspired me to finally get my backside down on the chair and whip something up, namely the
      Module Api Doc Viewer
      ProcessModuleApiDoc
      It lets you browse the inline documentation and public (optionally also protected) class/method/property information for all modules, core classes and template files in the ProcessWire instance. The documentation is generated on the fly, so you don't have to remember to update your docs whenever you update a module.
      The module is quite fresh, so expect some bugs there. Behind the scenes it uses PHP-Parser together with a custom class that extracts the information I needed, and the core TextformatterMarkdownExtra module for rendering the description part in the phpdoc style comments.
      This is not a replacement / competitor to the API Viewer included in the commercial ProDevTools package. There is quite some information included in the inline documentation that my module can't (and won't) parse, but which makes up parts of the official ProcessWire API docs.
      This, instead, is a kind of Swiss army knife to view PHPDoc style information and get a quick class or function reference.
      If you feel daring and want to give it a spin, or if you just want to read a bit more, visit the module's GitHub repository.
      This is the overview page under "Setup" -> "Module API Docs":

      And this is what the documentation for an individual class looks like:

      The core module documentation can of course be found online, but it didn't make sense not to include them.
      Let me know what you think!

    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
    • By teppo
      Admin Restrict Branch Select is an add-on / companion module for Admin Restrict Branch. With this module enabled, you can manually select more than one branch parent per user via the branch_parent field, and users with more than one option selected will be able to switch between those while editing site content. Switching between branches is done via a select field injected at the top of the page tree.
      Note that users are still limited to one branch at a time: this module will not make it possible to view multiple branches at the same time.
      When the module is installed, it will automatically update the branch_parent field if deemed necessary, i.e. if it isn't yet configured to allow selecting multiple pages. You can make changes to the field later, if you want to restrict selectable options by template, use asmSelect instead of PageListSelectMultiple, etc. 
      This is an early beta release, so be sure to test carefully before enabling this module in production!
      https://processwire.com/modules/admin-restrict-branch-select/
      https://github.com/teppokoivula/AdminRestrictBranchSelect
×
×
  • Create New...