[Mobile app] Problem with update end user password

Hi,

Im try to create a reset password function for mobile app user by change their password using the action User_Update in Users API:

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/Users_API#ChangePassword

The problem is that the User_Update action required UserModel, but we only have username and encrypted password. So after the API changed the password, all other fields was set to null because there is no data.

So what is the correct way to update user password ? Im tried find an API action that will return all user info to pass the data to User_Update action but there is none (only action for returning UserId and name of user)

Hi DG Pharm,

You should use the EncryptPassword Action from the Users eSpace.

You need to reference it via the Manage Dependencies pop-up:


Ref :

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/Users_API

Cheers

assif_tiger wrote:

Hi DG Pharm,

You should use the EncryptPassword Action from the Users eSpace.

You need to reference it via the Manage Dependencies pop-up:


Ref :

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/Users_API

Cheers

Hi assif_tiger,

I can get the encrypted password with EncryptPassword action. The problem is when i call the action User_Update with the encrypted password, all other data of user model was null because i have no data to pass to the action.

Im tried find an API action that will return all user info to pass the data to User_Update action but there is none (only action for returning UserId and name of user)

Hi,

can you specify what other details you need while you are updating the user info:

perhaps lets consider if you need username then do proceed by below steps:


You can  use the server actions of the User Api like the User_GetName()

  1. Set a dependency to User_GetName() from the Users Producer (Ctrl+Q)
  2. Create a Fetch data from other source on your mobile screen
  3. Set the output parameter to the value of User_GetName()
  4. Use the GetLoggedInUserName() in you screen in an expression.




Another way would be to add a Fetch data from database to your screen and an aggregate on the Users entity with a filter Users.Id = GetUserId()

Cheers,

Assif



All data in the user model, because if i leave any property in user model as blank, it will update the property to blank, and overrided any existing data, that is the problem.

There are only action for returning UserID and Name of User. 

Hi there,

Is there anyone can help me solve this issue ?

Fetch the user record based on username

Now Assign the new encrypted password to password of the old record

Now create a new output variable of type user record and assign the record which is fetched from the aggregate


Now pass the user record to update user action as source record

Hope it will help you.

Regards,

Koushik

Koushik Prathi wrote:

Fetch the user record based on username

Now Assign the new encrypted password to password of the old record

Now create a new output variable of type user record and assign the record which is fetched from the aggregate


Now pass the user record to update user action as source record

Hope it will help you.

Regards,

Koushik


Hi Koushik Prathi

Where can i find the GetUsersByUsername method, i have the Users dependency in my project but i can't find GetUsersByUsername in data tab or any other place ?

Hi DG,

That is an aggregate which Koushik had created by simply drag drop wit users as input parameter.

Instead, you can also use GetForUpdateUser Action from the Data tab under user table.



Waseema.

Waseema wrote:

Hi DG,

That is an aggregate which Koushik had created by simply drag drop wit users as input parameter.

Instead, you can also use GetForUpdateUser Action from the Data tab under user table.



Waseema.


Hi Waseema,


The action you mentioned is GetForUpdateUser, i can't find that action in Data tab under user table.

In the screenshot you highlighted CreateOrUpdateUser action, it's only create or update an existing user, i need an action to retrieve user data so i can update it !

Hi Pham,

Steps for updating password

1)Get the user data from the entity using "Fetch data from database"

2)Create a form for update the password

3)Assign the aggregate corresponding variable type with the form variable

4)On Button "save Action" encrypt the updated  password and save in the user entity

I am attaching the oml file for reference. Hope it will help you.

Regards,

Koushik

Solution

DG Pham wrote:

Waseema wrote:

Hi DG,

That is an aggregate which Koushik had created by simply drag drop wit users as input parameter.

Instead, you can also use GetForUpdateUser Action from the Data tab under user table.



Waseema.


Hi Waseema,


The action you mentioned is GetForUpdateUser, i can't find that action in Data tab under user table.

In the screenshot you highlighted CreateOrUpdateUser action, it's only create or update an existing user, i need an action to retrieve user data so i can update it !


Hi DG,


Here is the screenshot:




Thanks,

Waseema.

Solution

Thank you Waseema, i can find it now.