portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pham Tuan Minh <pham_tuan_m...@yahoo.com>
Subject Forgotten Password
Date Wed, 18 Jan 2006 10:57:14 GMT
Hi,

Steps and my problem:

- Step 1. I reset my password (use some code lines which I wrote).
- Step 2. I login portal successfully with my new password.
- Step 3. The problem is
Except default-page.psml in webapps\jetspeed\WEB-INF\pages\, I can't view   others page in
webapps\jetspeed\WEB-INF\pages\
- Step 4. I logout.
- Step 5. I can view any page in webapps\jetspeed\WEB-INF\pages\


I used the following code lines to reset user password:
__________________
String strNewPassword = admin.generatePassword();
 String strUrlGuid = makeGuid(strUserName, strNewPassword);
Map map = new HashMap();
map.put("user.name", strUserName);
map.put("password", strNewPassword);
admin.putNewLoginInfo(strUrlGuid, map);
updatePasswordFromGuid(strUrlGuid);
___________________

makeGuid(), updatePasswordFromGuid() are functions in ForgottenPasswordPortlet.java in package
org.apache.jetspeed.portlets.registration;
in applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/ForgottenPasswordPortlet.java

  public static String makeGuid(String user, String newpw)
  {
      // This is a quicky version
      long num = (long) user.hashCode() + (long) newpw.hashCode();
      long d = new Date().getTime();
      long val = num * d;
      String retval = Long.toHexString(val);
      return retval;
    }

  private boolean updatePasswordFromGuid(String strGuid)
  {
    Map map = admin.getNewLoginInfo(strGuid);
    String strUserName = (String) map.get("user.name");
    String strNewPassword = (String) map.get("password");

    try
    {
        userManager.setPassword(strUserName, null, strNewPassword);
        userManager.setPasswordUpdateRequired(strUserName, true);
        // if we got here stuff is changed... removed the key from the map
        admin.removeNewLoginInfo(strGuid);
    } catch (SecurityException e)
    {
        return false;
    }
    return true;
 }
_____________________________



What is the wrong  in the above code lines ?
When I login with my new password, why can't I view any page ?
With the same pages, I don't need login but I can view them.

I have read  carefully codes from ForgottenPasswordPortlet.java but I haven't resolved the
problem yet.

Please, help me. Thank in advanced.


			
---------------------------------
Yahoo! Photos
 Got holiday prints? See all the ways to get quality prints in your hands ASAP.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message