PHPMaker has the ability to generate the Request Password page which will allow end-users to reset their password easily and quickly. They simply click on Forgot Password link from the Login page, then follow the instruction in the next page. In the Request Password page, they have to enter their Email Address and click on the button, and let system handling the rest of the reset password process.
Unfortunately, not all end-users remember their email address (but they do remember their Username!). Therefore, they cannot do anything unless to contact admin to inquiry their Email Address (since the only provided field in the Request Password page is Email). Of course, we don't want this condition will be occured in our web applications. To solve this issue, then we simply should provide the Username field in Request Password page, so that end-users will have another option to enter their Username in case they forgot their Email Address.
To implement this change in the Request Password page, I just customized MasinoForgotPwd10 extension to handle the solution above. Now from the extension side, there is a new setting named KnownFieldOptions added; which has three option values as follows:
- Email: if you choose this option and regenerate the script files, then in the generated forgotpwd.php page there will be only one textbox of Email which has the label Email at the left side of it. This is the default option if you have not changed anything, yet from the extension side. You may use this option if you want to strictly your end-users only providing Email address to reset their password (just like the existing condition).
- Username: If you choose this option and regenerate the script files, then in the generated forgotpwd.php page there will be only one textbox of Username which has the label Username at the left side of it. You may use this option, if you want to strictly your end-users only providing their Username to reset their password.
- EmailOrUsername: if you choose this option and regenerate the script files, then in the generated forgotpwd.php page there will be two radio buttons which have the options Email or Username. By default the first option (Email) is chosen, and the only textbox will be refered to Email field. When end-user chooses or switch to Username, then the only textbox will be refered to Username.
Now the decission is in your hand. You may choose one of those three options. The third option is the recommended option if you want to provide the flexibility to your end-users whether to choose Email or Username to reset their password. The rest of the process will be handled properly by the generated forgotpwd.php page to reset the password just like the existing condition, based on the chosen field above.
Keep in mind that you have to make sure have regenerated at least two files for this change: ewcfg10.php and forgotpwd.php files. You can simply change/switch from one option to another by changing the following code in the generated ewcfg10.php file:
define("MS_KNOWN_FIELD_OPTIONS", "EmailOrUsername", TRUE); // available: Email, Username, EmailOrUsername, modified by Masino Sinaga, April 21, 2014
In other words, no need to regenerate those two files above each time you want to switch from one option to another. In case you do not provide or choose one of the three options above, then the first option (Email, just like the existing condition) will be used by default.
Want to see the demo? Just click here.
Want to download the extension? Then simply click here!
Now it's time for your to implement this enhancement into your Request Password page, and let your end-users enjoy this new feature. 🙂
Leave a Reply
You must be logged in to post a comment.