While I was browsing through the User Management Engine (UME) API, I came across a method which I can use to change a user’s password. I could make use of it to change my own password. Or for that matter make an application which I can assign to every user to change his/her own password. Right, there is a Change Password iView under Admin Interfaces, but in the later versions of Portal it has been replaced with a Webdynpro application wherein a user can change his entire profile. So if you would like to have only the Password iview you got to follow an SAP Note. But, what if you would like to change the look or enhance it. I’ve done that with a few more functionalities. One being Client side validation. The other being auto logout and redirection to the portal login page after the password has been changed.
I am going to use JSP DynPage as the technology as it has a scope for server event management. The first screen would have a welcome message, a password box for the user to enter his/her desired password and a button to execute the password change program. The second screen would display a message indicating the status i.e. whether the password has been changed successfully or not. I am using a bean to transfer the data across the 2 views.
The entire code; I have made available on Wiki -> Code Gallery whose link will be mentioned below:
1. Create the Project Structure
Before I start, the configurations I’m working on are SAP WebAS (Java) 7.0 SPS 09, EP 7.0, NWDS 7.0.06
In the NWDS, create a New Portal Application Project and name it com.mycomp.passwordchange. Within this, create a New Portal Application Object. Select the Template as JSP DynPage. Enter the Name “PasswordChange”, Location “Core”, Class Name “PasswordChange”, Package Name “com.mycomp”, JSP Filename “PasswordChange.jsp”. In the next step, choose the Option “Generate bean statements”, give it a name “PasswordBean” and the scope “Application”. Alternate click on the Pagelet folder and create another jsp file “Success.jsp”. With this we have the project structure created, and now we have to go in for the implementation.
Steps 2. to 6.
These steps consist of the rest of the implementation through code. They are available at Wiki -> Code Gallery. Placing entire blocks of code on the Blog editor is a mess (for some reason the textarea approach does’nt work). Another advantage of placing the program here is that it can be edited for the good.
Do follow this link:
a. The first view
b. Client side validation for wrong retyped password
c. Server side validation for password not meeting the requirements
d. On Change of Password and subsequent Log Off