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 extend Liferay 6.2 session timeout by AJAX call?

How to clear cache programmatically in JSP?

How to get context path in JQuery?