knadh / listmonk

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
https://listmonk.app
GNU Affero General Public License v3.0
15.19k stars 1.39k forks source link

Add Custom Attributes to users in form #536

Closed code3z closed 2 years ago

code3z commented 3 years ago

Here is my code:

                <p><input type="email" class="nq-input" name="email" placeholder="Email" /></p>
                <p><input type="name" class="nq-input" name="name" placeholder="Name (optional)" /></p>
                <p><input type="text" class="nq-input" name="website" placeholder="Website (optional)" /></p>

                <p class="text-center">
                    <input id="8c3cb" type="checkbox" name="l" checked value="8c3cb42c-6ded-43d7-b5ed-27121497bed8" />
                    <label for="8c3cb">Get Notified</label>
                </p>

                <p><input v-ripple class="nq-button" type="submit" value="Subscribe" /></p>

How can I allow the user to specify their website and have it show up as a custom attribute?

knadh commented 3 years ago

The public form endpoint does not accept attributes as that would allow users to enter arbitrary JSON payloads, creating security implications. If you want to insert subscribers with custom JSON attributes, you've to make your own form on top of the POST /api/subscribers API.

code3z commented 3 years ago

It would be a nice feature to allow users to specify certain attributes (name, email, and something else) themselves. This could be separate from the JSON attributes feature.

TIMBLOCKER commented 2 months ago

Hi knadh, there seems to currently be no easy way, but it is very inconvenient having to develop your own frontend with the respective endpoints.

It would be really great if there was an easy way to add custom fields to the signup form (i.e. numeric, string(maxLength), boolean). These could be typechecked to make up for the aforementioned security concerns before entering them as JSON payload.

This feature seems to have a valid use and great impact on the usability, as users can rely more intensively on listmonk instead of having to administrate another database with the respective fields (I want to be using it as a mail tool for my local triathlon team and we have a need to admin some ids and other fields). I get your point of having to deal with security. Maybe you could reconsider allowing this (maybe in an experimental mode?) so that this feature can be used and administrated.

Thanks for the great tool!

Tim from Germany