Foren

How to check current password in sdk structs portlet

thumbnail
Madhava Reddy Solipuram, geändert vor 12 Jahren.

How to check current password in sdk structs portlet

Junior Member Beiträge: 45 Beitrittsdatum: 27.06.11 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: How to check current password in sdk structs portlet

Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: How to check current password in sdk structs portlet

Junior Member Beiträge: 45 Beitrittsdatum: 27.06.11 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: How to check current password in sdk structs portlet

Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste Beiträge
Good to know that emoticon
thumbnail
Arunjyoti Banik, geändert vor 9 Jahren.

RE: How to check current password in sdk structs portlet

Junior Member Beiträge: 74 Beitrittsdatum: 26.08.14 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: How to check current password in sdk structs portlet

Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: How to check current password in sdk structs portlet

Liferay Master Beiträge: 875 Beitrittsdatum: 07.01.11 Neueste Beiträge
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, geändert vor 12 Jahren.

RE: How to check current password in sdk structs portlet

Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
Yes in that case you are right .
cheers !!!