Fórumok

How to check current password in sdk structs portlet

thumbnail
Madhava Reddy Solipuram, módosítva 12 év-val korábban

How to check current password in sdk structs portlet

Junior Member Bejegyzések: 45 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
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, módosítva 12 év-val korábban

RE: How to check current password in sdk structs portlet

Liferay Master Bejegyzések: 875 Csatlakozás dátuma: 2011.01.07. Legújabb bejegyzések
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, módosítva 12 év-val korábban

RE: How to check current password in sdk structs portlet

Junior Member Bejegyzések: 45 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
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, módosítva 12 év-val korábban

RE: How to check current password in sdk structs portlet

Liferay Master Bejegyzések: 875 Csatlakozás dátuma: 2011.01.07. Legújabb bejegyzések
Good to know that emoticon
thumbnail
Arunjyoti Banik, módosítva 9 év-val korábban

RE: How to check current password in sdk structs portlet

Junior Member Bejegyzések: 74 Csatlakozás dátuma: 2014.08.26. Legújabb bejegyzések
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, módosítva 12 év-val korábban

RE: How to check current password in sdk structs portlet

Liferay Master Bejegyzések: 803 Csatlakozás dátuma: 2008.03.10. Legújabb bejegyzések
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, módosítva 12 év-val korábban

RE: How to check current password in sdk structs portlet

Liferay Master Bejegyzések: 875 Csatlakozás dátuma: 2011.01.07. Legújabb bejegyzések
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, módosítva 12 év-val korábban

RE: How to check current password in sdk structs portlet

Liferay Master Bejegyzések: 803 Csatlakozás dátuma: 2008.03.10. Legújabb bejegyzések
Yes in that case you are right .
cheers !!!