Fórum

How to check current password in sdk structs portlet

thumbnail
Madhava Reddy Solipuram, modificado 12 Anos atrás.

How to check current password in sdk structs portlet

Junior Member Postagens: 45 Data de Entrada: 27/06/11 Postagens Recentes
Hi all,

I am developing change password application. In that i am capturing current password, new password, re-enter password,
I am able to update the new password. But i don't know how to check the current password is valid or not,
because i can't use PwdAuthenticator.authenticate(login, currentPassword, user.getPassword()); class in sdk portlet.
Is there any other way to check the current password is valid or not.

Please suggest me.
thumbnail
Jitendra Rajput, modificado 12 Anos atrás.

RE: How to check current password in sdk structs portlet

Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
Use


  int oldPwdAuth = 0;
  Map headerMap = new HashMap();
  Map parameterMap = portletRequest.getParameterMap();
int oldPwdAuth = UserLocalServiceUtil.authenticateByEmailAddress(user.getCompanyId(), user.getLogin(), password, headerMap, parameterMap);


If oldPwdAuth =1 it means your old password is correct
thumbnail
Madhava Reddy Solipuram, modificado 12 Anos atrás.

RE: How to check current password in sdk structs portlet

Junior Member Postagens: 45 Data de Entrada: 27/06/11 Postagens Recentes
Jitendra Rajput:
Use


  int oldPwdAuth = 0;
  Map headerMap = new HashMap();
  Map parameterMap = portletRequest.getParameterMap();
int oldPwdAuth = UserLocalServiceUtil.authenticateByEmailAddress(user.getCompanyId(), user.getLogin(), password, headerMap, parameterMap);


If oldPwdAuth =1 it means your old password is correct



Thanks Jitendra,

It solved my problem, basically i want to compare current password(which is entered while changing the password) and DB password.
thumbnail
Jitendra Rajput, modificado 12 Anos atrás.

RE: How to check current password in sdk structs portlet

Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
Good to know that emoticon
thumbnail
Arunjyoti Banik, modificado 9 Anos atrás.

RE: How to check current password in sdk structs portlet

Junior Member Postagens: 74 Data de Entrada: 26/08/14 Postagens Recentes
Madhava Reddy Solipuram:
Jitendra Rajput:
Use


  int oldPwdAuth = 0;
  Map headerMap = new HashMap();
  Map parameterMap = portletRequest.getParameterMap();
int oldPwdAuth = UserLocalServiceUtil.authenticateByEmailAddress(user.getCompanyId(), user.getLogin(), password, headerMap, parameterMap);


If oldPwdAuth =1 it means your old password is correct



Thanks Jitendra,

It solved my problem, basically i want to compare current password(which is entered while changing the password) and DB password.



what about the resultsMap? How are you initialing that??
thumbnail
Jignesh Vachhani, modificado 12 Anos atrás.

RE: How to check current password in sdk structs portlet

Liferay Master Postagens: 803 Data de Entrada: 10/03/08 Postagens Recentes
If i understand properly you want password value right?
IF its like that then you can not get existing password value in decrypted format as this is security concern here.
In Liferay when you create or reset a password then only you will have password value so that you can send it through mail.
or else you liferay doesn't have any API available which will give you password value without encryption.
thumbnail
Jitendra Rajput, modificado 12 Anos atrás.

RE: How to check current password in sdk structs portlet

Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
Jignesh..we can not get password from DB .for any user...

But we can get logged in user's password from request..

PortalUtil.getUserPassword(request)
thumbnail
Jignesh Vachhani, modificado 12 Anos atrás.

RE: How to check current password in sdk structs portlet

Liferay Master Postagens: 803 Data de Entrada: 10/03/08 Postagens Recentes
Yes in that case you are right .
cheers !!!