Retriving username and password from session in Liferay 6.2

              String userName = null;

               try {

userName = PortalUtil.getUser(httpRequest).getEmailAddress();

} catch (Exception e) {

System.out.println("Exception in retriving user name -> " + e.getMessage());

}

String password = null;

try {

password = (String)httpRequest.getSession().getAttribute(WebKeys.USER_PASSWORD);

} catch (Exception e) {

System.out.println("Exception in retriving password -> " + e.getMessage());

}


Note: Here for getting plain password we need to set below property in portal-ext.properties file.

session.store.password=true

Comments

Popular posts from this blog

How to get context path in JQuery?

How to extend Liferay 6.2 session timeout by AJAX call?