Foren

How to know if it is required to change the password

thumbnail
Genar Codina, geändert vor 7 Jahren.

How to know if it is required to change the password

Junior Member Beiträge: 28 Beitrittsdatum: 18.04.16 Neueste Beiträge
I can login and also change the password without any problem using the "Liferay mobile SDK" for iOS.

However, I would like to know if there is a method in the API in order to know if a user, after a successfully login, has to change his/her password in order to show a new screen (something like "Enter new password") for that purpose.

Additional info: I have seen that a user has to change his/her password if:
1) control pannel->password policies-> check box “Change Required” is checked AND
2) The user has logged in successfully for first time in the web page and then, according to the previous point, a new screen appears in order force him/her to change the password.

So, I would like to call a method, from "Liferay mobile SDK" similar to something like "hasTheUserToChangeThePassword" which:
a) returns "true" if the user has logged in successfully for the first time and the control pannel->password policies-> check box “Change Required” is checked
b) returns "false" if the user has already logged in successfully in the web page and has changed the password (because it has been forced to do it on the web page). So, if that user logs in again using the mobile app, then he/she will not have to change the password again.

Thanks in advance.
thumbnail
Javier Gamarra, geändert vor 7 Jahren.

RE: How to know if it is required to change the password

Expert Beiträge: 348 Beitrittsdatum: 12.02.15 Neueste Beiträge
There is a column in the User table that controls if the user has to reset his password, it's called passwordReset but it isn't exposed automatically in the json web services.

You will have to create a method to expose that info (check the screens plugin compatibility code, it's very easy) and generate a mobile web service with the mobile sdk builder to use it in both platforms.

If you need more guidance, I'll happy to explain the steps in detail emoticon
thumbnail
Genar Codina, geändert vor 7 Jahren.

RE: How to know if it is required to change the password

Junior Member Beiträge: 28 Beitrittsdatum: 18.04.16 Neueste Beiträge
Hi Javier,

I think that I need some help because I do not know how to start (at least the first steps)

Additional info:I have gone to the web page:
https://web.liferay.com/marketplace/-/mp/application/54365664
and I have downloaded the "Liferay CE Screens Compatibility" plugin; that is a "Liferay CE Screens Compatibility.lpkg", but I only wanted to check the code; but I could not do anything on my iMac. Perhaps I will need to install "Liferay CE Screens Compatibility.lpkg" on the server which runs Liferay and then I will be able to check the code.

Thanks in advance,
thumbnail
Javier Gamarra, geändert vor 7 Jahren.

RE: How to know if it is required to change the password (Antwort)

Expert Beiträge: 348 Beitrittsdatum: 12.02.15 Neueste Beiträge
Sorry I maybe throw you off with the screens suggestion.

I mean that you have to create a plugin exposing the user table, the same way the screens plugin does here.

Basically, you have to create a plugin with the liferay plugins sdk and with the service builder add a reference to the user model. And then create a method (like these) that, given a userId, returns the user json object (with JSONFactoryUtil.createJSONObject(JSONFactoryUtil.looseSerialize(user)));).

And then call ant build-service to generate the methods.

The Liferay plugins SDK documentation explains how to create such a plugin, it should be just less than 3 lines of code emoticon
thumbnail
Genar Codina, geändert vor 7 Jahren.

RE: How to know if it is required to change the password

Junior Member Beiträge: 28 Beitrittsdatum: 18.04.16 Neueste Beiträge
Thanks for your help.