When the password has expired in web applications that generated by PHPMaker, then there will be a Change Password page shown up, including the standard message: Password Expired. Please change password.. It means that the system will force users to change their password immediately, otherwise they cannot login into the system properly. This is one of the best security features that provided by PHPMaker in web applications that generated by it.
Sometimes, end users will get confused when they saw that Change Password page that enforces them to change the password, even the standard message above has been shown up. They usually will get panic for a moment when they are getting that message. Moreover they will not be able to login before they change the password. So, that would be better if we display an additional message that will explain in more detail about what steps that should be done by users in order to get logged in properly.
This following trick will show you how we can display the custom message besides that standard message above easily and quickly. We will use the certain Server Event to display it nicely. In other words, we will not customize the generated code nor the template to display that custom message.
- Open .pmp (PHPMaker Project) file by using PHPMaker application.
Go to Server Events, Client Scripts and Custom Templates) tab, then expand the following location: Server Events -> Global -> All Pages -> User_PasswordExpired, and insert the following code:
CurrentPage()->setFailureMessage("This following <strong>Change Password</strong> page is being shown up since your password has expired. You have to change your password immediately, otherwise, you cannot continue login to the system normally. If you forgot your password, then you may reset your password by clicking on <strong>Forgot Password</strong> link on the Login page. Use the password that you will get from the email after recovering your password in <strong>Old Password</strong>, and then type your new password in <strong>New Password</strong> and <strong>Confirm Password</strong> directives respectively.");
- If you don't want to use setFailureMessage, then you can use setSuccessMessage instead to show the message in the information mode.
- Save the project, then re-generate the script files using PHPMaker as always.