Need to add custom button which resets the password by taking the values email and password to an custom API and refresh the page when the API success response is recieved. If possible it should open a pop up with enter new password
Feature(s) impacted
Observed behavior
Expected behavior
Context
- Project name:Whydonate
- Database type: MySql
Hello @Jaspreet_Singh !
Welcome to the Forest community !
You can create a smart action and use custom success notifications to show the new password.
The code can be something like this
// forest/users.js
actions: [{ name:"reset password", type: "single"}],
// routes/users.js
router.post('/actions/reset-password', permissionMiddlewareCreator.smartAction(),async(request, response) => {
const recordGetter = new RecordGetter(clients, request.user, request.query);
const record = await recordGetter.get(request.body.data.attributes.ids[0]);
const newPassword = await fetchNewPassword(record.email, record.password); // fetch new password from custom API
await users.update({ password: newPassword }, { where: { id: record.id } });
response.send({ success: `Password updated` })
});
Is there way to place a button against the password?
In the detail view, the action created will be in the header’s Actions
dropdown :
But you can use a workspace or the summary view to arrange the data as you want and put an action button near the password field
So I cannot create a button and place it alongside of password field?
No, at least not in the record details