{ "version":"2.2.0","name":"Reset User Password","description":"Admin reset of user password with temporary password","trigger":{"type":"http","method":"POST","path":"/users/:userId/reset-password"},"nodes":[{"id":"check_permission","type":"operation","op":"condition","condition":"{{ $context.user.level >= 3 }}"},{"id":"fetch_user","type":"operation","op":"database_read","entity":"User","params":{"filter":{"id":"{{ $json.userId }}","tenantId":"{{ $context.tenantId }}"}}},{"id":"generate_temp_password","type":"operation","op":"crypto","operation":"generate_random_token","length":16},{"id":"hash_password","type":"operation","op":"crypto","operation":"bcrypt_hash","input":"{{ $steps.generate_temp_password.output }}","rounds":12},{"id":"update_user","type":"operation","op":"database_update","entity":"User","params":{"filter":{"id":"{{ $json.userId }}"},"data":{"passwordHash":"{{ $steps.hash_password.output }}","firstLogin":true,"passwordChangedAt":null}}},{"id":"send_reset_email","type":"operation","op":"email_send","to":"{{ $steps.fetch_user.output.email }}","subject":"Your password has been reset","template":"password_reset_admin","data":{"tempPassword":"{{ $steps.generate_temp_password.output }}"}},{"id":"return_success","type":"action","action":"http_response","status":200,"body":{"message":"Password reset. Temporary password sent to user email"}}}] }