How to let your users delete their own account

Hi all,

First of all: the new two way user sync feature doesn’t allow to delete your users in Softr directly from Airtable. The purpose of this limitation is to avoid any unwanted deletion.

Second point: this guide follows best practices in terms of user experience.

So how to let your users delete their own account?

Start by adding a cta block just below a user account block.

The action for the button “Delete My Account” will be an ‘open modal’ (Here it’s a small size modal). It will open a page with just a form in it.

This form has four goals:

  1. Add a step before deleting the user account, as it is a permanent deletion
  2. Ask the user for their reason to leave
  3. Keep track of user deletions (Analytics + possibility to re-engage the user, later)
  4. And of course, delete the user account.

The form has two hidden fields: logged in user name and logged in user email.
The form has one dropdown field with the options (reasons to leave) manually added and set to ‘required field’.
Also, very important, the datasource option for this form is “Send to Make”.

Here is the Make scenario:

You may wonder why there is an Airtable ‘Create a Record’ module at the end of the scenario. This is made to populate the user deletion table. This way, even if a user deletes their account, you will have their information (specifically their email if you want to re-engage them later).
Here is the User Deletion table:

Last but not least: a small javascript snippet to be added in the page settings (header custom code) where the form is.
This code has two goals:

  1. Redirect the user to the sign up page (or wherever you want) when their account is deleted
  2. Add some time before the redirection, as there is an ongoing Make scenario.

Here is the code:

<script>
  document.addEventListener('block-loaded-form2', () => {
    window.addEventListener('submit-form-success-form2', () => {
      setTimeout(() => {
        window.parent.location.href = 'https://yourdomain/signup';
      }, 2000);
    });
  });
</script>

Just replace ‘form2’ by the Id of your form and ‘https ://yourdomain/signup’ by the url you want the user to be redirected to after deleting their account.

Finally, note that this guide might not be fully compliant with the law of your country concerning data privacy and data retention (unless you fully inform your users that their name and email will be kept despite of their account deletion)=> In order to do so, you would need to update the last Make module (the module Create A Record in Airtable) and just have two fields in your user deletion table : Reason to leave + Deletion date (which is a ‘creation date’ type of field in Airtable). Everyhting about the user name and user email should go away.

That’s it!

Here is the final result:

ezgif-2-488fbbd432

6 Likes

What an amazing workaround @matthieu_chateau :star_struck:

Thanks a ton.

1 Like

Thank you @matthieu_chateau very considered for always considering the user experience at the top of every action.

Good job.

Thanks a lot!

This is awesome man.

When I grow up , I want to be like Matthieu. :smiley:

Ahaha thanks!
Feeling like an old man now but thanks :joy:

1 Like

If the user is adding an other user email, he is able then to delete someone else account using this form as the webhook does not contain the user login information but the information the user would decide to add manually to the form. This is an issue, isn’t it?

Nope, the webhook contains the logged in user information => the button can be part of a list details block set to be only related to the logged in user.

But in this case = the form takes the logged in user information (here the email) thanks to hidden fields.

Got it brillant !

I have done exactly whta you have indicated but Make does not get the user name or email.

STEP 1: Create the delete button on the Log in Page

STEP 2: Create the form on a new page with the make webhook

STEP 3: Edit the button so it opens the page with the form in a modal window

STEP 4: Create the MAKE PROCESS

STEP 5 test the form by clicking on the delete button and by filling the form and submitting it.

RESULT: I do not get the email or user email in the output in Make

What do I do wrong?

Found it, HIDDEN FIELD in the form, great !

Just implemented this, super helpful!!!