Security provider Register and confirmation email?

Is there any documentation or anyone has made a registration page that sends a confirmation email, that until the user doesnt confirm they can not log in, how can this be done with wappler?

Hello, you can do this by using two server actions:

  1. One which creates (inserts) the user. It uses an insert record step and send mail step.
    In the send mail step send a dynamic link which includes the inserted user id and the email as url params: yourlink.php?email={{useremail}}&id={{userid}}
  2. Update server action filtered by id and email get variables. Put it on the page you send in the email and filter by the two url vars bound to the get variables values.

Initially when the user registers, add in active column a value of 0.
Then when he clicks the link in the email change the active value to 1.

2 Likes

Is there any way to create random strings for register sessions, I use to do something like this:

and that random string I would save it for the confirmation email plus the user email, in order to make it a bit more secure?

Can I use functions I create my self?

There are a couple of threads which may be relevant:
here
and
here

Awesome thanks for sharing those links

how do you pass the id if the record is been inserted?

The id of the inserted record is immediately available in th steps you add after the insert record step in your server action. Just add insert, add some other step after it and the inserted identity becomes available in the dynamic data picker.

1 Like

@Teodor Regarding #1 - how can I pass these values into an email template/file and render them within the template?

Thanks in advance.[

Hi Niall,

Which values are you referring to?

After the insert step, I’m not sure how I can use an email template/file and within it, bind to the values returned from the insert step to construct the dynamic link that the user will click to verify their registration.

Which values (from the insert step) are you interested in exactly? The insert step shows “Identity” in the data picker, so you can bind it in the email body.

How do I expose “indentity” from my registration server action so that it’s available for binding within the email_file.php? If I add Server Connect within this template and select the action so I can access the identity, doesn’t the action run? I definitely don’t want the action execute again. Apologies if I’m missing something simple.

Niall,
As soon as you add the send mail step to your server action (after the insert step of course!) you will see the identity returned by the insert step in the dynamic data picker!

Yup, and that’s fine if I’m sending a static email from what I can see, but how do I access the identity when I’m using an email file - eg. Output the identity within the email file’s body?

Click the dynamic data picker in the mail body and you will see it …

That’s fine for a static email body, but as I’ve said, I’m using a separate file/template…not sure how to accomplish the same thing in that scenario.

It’s the same:

2 Likes

Thanks for clarifying @Teodor :smiley: