Forums

E-Mail verification - double-opt-in

Denny87 20 Jun, 2018
Hi,

is there any step by step documentation how i can integrate and email verification without joomla registration?

So actually i have the following things in my submit event:

-Save data
- Upload files
- Message
- Email to the user

What i need:
- Save data
- Upload files
- Message
- Email to the User with all informations which he
provided and verification link.
- After click on link update database record (e.g.
status „verified“)
- Thanks Message
- Email to me with provided informations

So how can i set up the link? I don't know what to do, so please can you explain it for a rookie...

Thanks,
Denny
GreyHead 20 Jun, 2018
Hi Denny,

I would add a new event for the verification called say 'verify'. Then the link in your email can be like
<a href='https://my_domain.com/index.php?option=com_chronoforms6&chronoform=form_name&event=verify&vid={var:vid}" />
The vid is your identifier, you can create that however you like, a short random string, a Joomla verification string, the record id, an encoded version of the user email . . . just make sure that it is saved in the form data as a data or var entry.

In the verify event you will need to check that the code is valid using a Read data action - if necessary you can add some other variables to the query string to let you double check. If it is valid then use a Save data action to update the status column and send the email.

Bob
Denny87 20 Jun, 2018
Hi Bob,

thanks for your answer.
Sorry but i still don't understand how to add this new event etc..
The "new event" what should it be, custom code?


It would be perfect if you can give me an example like -> Go to the setup tab, choose "custom code" and so on.

Hope you can understand what i mean...

Thanks for helping
Denny
GreyHead 21 Jun, 2018
Hi Denny,

An 'event' here is a new processing page form your form - by default there are Load and Submit events set in the form Setup tab. You can add a new one using the Add Event box under the existing pages. There is a little more info on page 8 of the CFv6 manual.

Once you have created the event you can add actions to it to do whatever you need.

Bob
Denny87 21 Jun, 2018
Hi Bob,

still don‘t get it :/
„You can add a new one using the Add Event box under the existing pages“
-> Where??

Denny
GreyHead 21 Jun, 2018
Hi Denny,

Scroll down the Setup tab. You will need to be in Advanced Designer mode to see the box.

Bob
Denny87 25 Jun, 2018
Hi Bob,

thanks, but there is nothing to add a new event.

GreyHead 25 Jun, 2018
Hi Denny,

There is on my version - I see that your Menu tabs - Save & Close etc. are at the bottom - that is odd.

Bob
Denny87 25 Jun, 2018
Really strange..
I checked it in chrome and firefox,, latest cf6 version..

So will you check it and let me know if there is any solution?
Unfortunately it is a little bit urgent...

Thanks again,

Denny
GreyHead 25 Jun, 2018
Hi Denny,

There is nothing for me to check.

You can use a separate form if you like to capture the responses.

By all means PM me the site URL, form name and a Super Admin login and I'll take a quick look.

Bob
Denny87 26 Jun, 2018
Hi Bob,

i've sended you a PM with login data.

Thanks,
Denny
GreyHead 26 Jun, 2018
Hi Denny,

It is there if you scroll to the bottom of the Setup tab a wait a bit - I have no idea why you get the secondary scrolling on the page. I have added a verify event for you.

Bob
Denny87 26 Jun, 2018
Hi Bob,

thanks.
Did you saved the form? Cause i can't see your new event.
What i found is, when i minimize the load and submit event, i can see the field to add a new event...

Can you also help me how i have to the check the database, create the link and update the database?
That would be great...

Thanks,
Denny
healyhatman 26 Jun, 2018
you might want to have a look at the instruction manual and the demo forms, or pay someone to do it all for you
Denny87 27 Jun, 2018
Maybe you're right, but in the demo forms i can't find any example for double-opt-in, same in the cf6 documentation.
In the older versions it was easy to setup double-opt-in cause of stuff like "verification sender" etc.

So i thought it would be great if Bob can help, if not, i have to try it by myself...
healyhatman 27 Jun, 2018
Use a Joomla user registration action. Put {uuid:} in the verification field or whatever it's called. Then send the user an email with a link with yourweb.com/linktoyourform?event=verify&code={var:registration_action_name.whatevertheverificationfieldiscalled}
If you do a test registration with debug after it you should be able to get the name of the field

Have a verify event in your form where you check the code anduodate the user record accordingly

If you search the forums Bob had a better explanation put up somewhere
Denny87 27 Jun, 2018
But I don't want to use the Joomla user registration.

The only problem i have now:

I have create two more fields in my database ("status" and "link_id"):

1. How can i set the value after submit to status = "unconfirmed" and link_id = "1" (autoincrement?)

2. Create the link in submit event with special message after clicking the link

3. Check link_id with "Read Data" in verify event? And then Update Database to status = "confirmed"
healyhatman 27 Jun, 2018
You're not using Joomla registration you're using the Joomla registration ACTION that Chronoforms provides in the setup tab
healyhatman 27 Jun, 2018
You don't need to create any new fields Joomla #__users provides everything you need.
Denny87 27 Jun, 2018
There is only:

Login
+ Save user
User activation

healyhatman 27 Jun, 2018
Save user, clearly.

User activation in the verify event
Denny87 27 Jun, 2018
Thanks for your help, but still don't get it which steps i have to do etc...

Thats what i have in my submit event actually:



Than i have a "verify" event, which is actuall empty.

Can you tell me step by step what to do and what i have to setup?

So i have to use "Save User" in my submit event and "User activation" in my verify event.
But what should i have to setup?





After that, how should be my link etc...

Sorry that i'm asking so much but it is very important that it works correctly and that i understand it.
healyhatman 27 Jun, 2018
This is what I mean about reading the instructions and looking at demo forms, you don't seem to have any idea how any of it works at all. Like you want to start driving a car and you're asking what a key is and what pedals look like.

In the save user action, the name/username/email/password fields all need to be the names of the fields that contain their data. So if you have a field where the user is entering their email address and it's called "email", then you put "email" in the "Email field provider" for example. Blocked status, activation code, groups ids and the data override should all be left alone.

The link you are sending to the user should be
<a href='https://my_domain.com/index.php?option=com_chronoforms6&chronoform=form_name&event=verify&vid={var:save_user_action_name.activation}">Link text here</a>

In the Verify event, "activation code provider" should be {data:vid} and New Block status should remain as it is.
Denny87 27 Jun, 2018
Yes you're partially right.
But in the demo forms is nothing like double-opt-in or am i wrong?
Also there is no real documentation for double-opt-in with examples. Or am i wrong too?

I'm still don't get the things done.

When you would do it, what would it cost?

Thanks,


healyhatman 27 Jun, 2018
I just told you everything you need. It's all there.

If you still need help I'll do it for you for $50 AUD.
healyhatman 27 Jun, 2018
Load event: show the user all the fields that need to be filled in.
  1. user fills in form
  2. clicks submit

Submit event:
  1. Verify Data to make sure everything that was required was entered in
  2. Save user
  3. Send email to user with link set up like I told you
  4. Display a message telling the user you have sent them an email with a link they need to access to verify their account
Verify event
  1. Use the user activation action, with the "activation code provider" set up exactly as I told you
  2. That's it, your new user is now succesfully double-opt-in verified.
Denny87 27 Jun, 2018
I did everything like you said.
But where can i see that the user did clicked the link?
This is the important thing.
And i think the link is not displayes correctly.
What i have setup is: ...............?chronoform=datenschutz&event=verify&vid={var:joomla_user16}
But in my email it is displayed like: .....?option=com_chronoforms6&chronoform=datenschutz&event=verify&vid=

?option=com_chronoforms6&chronoform=datenschutz&event=verify&vid=?option=com_chronoforms6&chronoform=datenschutz&event=verify&vid=
healyhatman 27 Jun, 2018
Should be joomla_user16.activation
Denny87 27 Jun, 2018
I changed it and link looks the same.
And where can i see if the user clicked the link?
healyhatman 27 Jun, 2018
You don't need to see where the user clicked the link, that's what the User Activation action does!

And 2 other things:

ONE: Fill in all the other fields in the save user action! Where's the password coming from? The username? If you don't have that set up properly, it won't work and it won't save the user and therefore won't HAVE an activation code to use!

TWO: USE A DEBUG ACTION so we can see what's happening. I guess your user isn't saving because you're not getting alll the necessary data.
Denny87 27 Jun, 2018
Okay i think you did not understand correctly what i want.
Because of that i opened the topic.

In my form the user don't has to fill a username or a password. So i cant fill all fields in the save user action!

This form is for users who wants to request their data of different systems we made.
So he has to fill in name, system name, do some file upload etc.

After submitting the form we need this verfication / double-opt-in via link and it is important to see if the user has verified his email or not.
healyhatman 27 Jun, 2018
Right well yes looks like there was confusion. Delete user save and user activation.

Use a "custom code" action on the Submit event. Call it "verification_id", turn on "var only result" and in content put only {uuid:}

Save data action to save the code and email to your awaiting verification table or wherever you're saving the data, you need to add {var:verification_id} to the data you're going to insert so it can be matched later

The link you send will be as above, except use {var:verification_id} instead of {var:joomla_user16.activation}

In verify event, make sure that {data:vid} exists and if not display an error. If it does exist, do a read data looking for fieldname:{data:vid}. Under the not found event show an error, under the found event do a save data action where you UPDATE whatever field it is you need to update to show that the email has been verified.
Denny87 27 Jun, 2018
We are getting closer to it! Thanks!

Now the link in my email looks great.

Now i just need to the verify event.

In added a field "vid" as int, default = null in my database.

1. make sure that {data:vid} exists -> how can i check this?

2. I have created the read data action, added the found event and choosed my database.
Should I enter in "Where conditions" ?

3. In the found event i added the save data action.
The data provider is {data:vid} and the write action "Update". Now i want that the vid in my database changes from null to 1. Do you know what i have to enter?

Actuall i'm getting an error after clicked the link (1054 - Unknown column 'Data18.{data' in 'where clause')
Data18 is my Read Data action.
healyhatman 27 Jun, 2018
NO, vid should be varchar 36 if vid is the code you want to check to make sure they've clicked the verification link.

1. Use a validate data event switcher: data source {data.empty:vid} with events true and false. Under the TRUE event, put your error message and a stopper IN THAT ORDER, Under FALSE, put everything else.

2. vid:{data:vid} exactly like that

3. Leave data provider empty. Override on update should have fieldname:1 where condition should be vid:{data:vid}

4. READ THE INSTRUCTIONS http://www.chronoengine.com/chronoforms/download?conn=downloads2&event=downloadfile&fname=forms&fversion=6&ftype=manual&fplatform=j25
Denny87 27 Jun, 2018
You're helping me a lot.
Thanks, really appreciate it!

I will read the instruction tomorrow. Thanks!

Now the link looks good and after clicking the link is no error.
I did this:



Not sure if it is correct,
The vid field is still empty.

Sorry for that you're taking so much time.
healyhatman 27 Jun, 2018
Why would the vid field be empty? What did you do in the submit event?
Denny87 28 Jun, 2018
I just did everything you said..
"Use a "custom code" action on the Submit event. Call it "verification_id", turn on "var only result" and in content put only {uuid:}"
healyhatman 28 Jun, 2018
And what about the link you're sending in the email, the link you're clicking on to verify, what does that look like?
Denny87 28 Jun, 2018
The link looks like:

https://mydomain.de/some_site_name?option=com_chronoforms6&chronoform=datenschutz&event=verify&vid= {var:verification_id}
healyhatman 28 Jun, 2018
So that's what you have in the body of the email event? Or are you literally typing that into the address bar?
Denny87 28 Jun, 2018
Yes right, this is in my body of the email action.

Some text
the link
and all of the fields

My Submit event looks like:

Validate Fields
on success;
- custom code
- save data
- upload files
- email
- message
- debugger

Verify event:

Validate Data
on success:
- Read data
FOUND
- Save data
healyhatman 28 Jun, 2018
And what does the link look like after you get it in your email?
Denny87 28 Jun, 2018
...................?option=com_chronoforms6&chronoform=datenschutz&event=verify&vid= af0669c4-2d0e-4ca4-8333-1fa1d4b4f633
healyhatman 28 Jun, 2018
Right well absolutely no reason why {data:vid} should be empty
Denny87 28 Jun, 2018
Maybe i have an error in my verify event?
See my setup:






GreyHead 28 Jun, 2018
Hi Denny87,

There is a space in the URL that might cause problems if it is real and not added in copying and pasting
&event=verify&vid= af0669c4-2d0e-4ca4-8333-1fa1d4b4f633
Bob
Denny87 28 Jun, 2018
Hi Bob,

yes true, i deleted it.
But the field is after clicking the link empty.
Should i setup the vid field special with something in the submit event?

Maybe you can have a quick look?
Denny87 29 Jun, 2018
Any idea why the field is empty after clicking the link?

Thanks
Denny
GreyHead 29 Jun, 2018
Hi Denny,

What field is empty? Does your verify event display anything?

I see that there is no Data provider entry in the Save data action, is the record being updated?

Adding a Debugger action will help you see what is going on.

Bob
Denny87 29 Jun, 2018
Hi Bob,

i'm actually not sure what i have to do.
I just need the field vid updated to 1 after the user verified his mail. so i can see that he has verified.
I just did everything what healyhatman said.

Can you please have a quick look? I think for you it is a "problem" which is solved in less than 5 minutes.
Denny87 02 Jul, 2018
Hi guys,

is there any update?
Need this to run...

Thanks for your support.
healyhatman 02 Jul, 2018
I keep telling you to read the instructions and you keep not doing it.

But anyway you're telling it to update the database where the vid is equal to the verification code you sent in the email. But have you ACTUALLY saved that verification code to the database? If not, how is it going to find the right row to update? And what if a user then changes the link in the address bar to vid=1 ? It will make your database update every row with vid = 1!

I'll do it for you for $50 AUD. It's not hard but you need to have a basic understanding of what it is you're trying to accomplish.
Denny87 02 Jul, 2018
I just want to understand it. For me it would be much more easier if there were any special example or demo. But there is no one.
Or do you have any example where is this topic explained?

When i save my database after submitting the form i just set vid:0.
After clicking the link i just want to update vid:1, and this is the only thing which is not working.
I think $50AUD is expensive cause i just bought keys for chronoforms and thought there is some support or help. Do you understand what i mean?
healyhatman 02 Jul, 2018
There IS support and there IS help. You're just asking people to just build your form for you. There are demo forms for saving data and for reading data, there's the instruction manual, but there's not going to be a demo for exactly what you want to do in the exact way you want to do it - there'd be billions of demo forms!

I will tell you one more time what you need to do. If you read the instructions you will be able to figure out how to do it, or you can pay me to build it for you. I don't work for Chronoengine so I'm under no obligation to give you even the help I've given.

STEP ONE
User fills in form, clicks submit.

IN SUBMIT EVENT
Generate a UUID code (the custom code block I told you to make)
Save the code to the database along with the email address - you need to do this so when the user clicks the link in their email, you know you're verifying the right user
Send the email to the user, with the code as part of the link they're clicking (like I told you to)

STEP TWO
User receives email, clicks verification link

IN VERIFY EVENT
Make sure {data:vid} exists and if it doesn't show an error
Read Database, look for the row where verification code = {data:vid}
IF FOUND: UPDATE action: set verified to true/1 , set the verification code field to {value:null}, update condition being where verification_field_name:{data:vid}
IF NOT FOUND: Show an error message saying they've made an invalid request.

The end!
Denny87 02 Jul, 2018
See in my screenshots what i have done.
Lets give it one last try, thanks!
SUBMIT






VERIFY





healyhatman 02 Jul, 2018
You still need to save the verification_id to check against!

In your save data action in your SUBMIT event ADD verification:{var:verification_id} to the data you're inserting

In your read data in the verify action change vid:{data:vid} to verification:{data:vid} and change the select type to first matching
In the save data action change the update condition to verification:{data:vid} and ADD verification:{value:null} to the Data override on Update


And just to make sure - this form you're building, the user has to be logged in to use it right?
healyhatman 02 Jul, 2018
In your data table vid should be BOOLEAN and verification should be VARCHAR 36
Denny87 02 Jul, 2018
i will try. Thanks,

No, no one should be logged in!
Denny87 02 Jul, 2018
maybe this is the real misunderstanding:

"And just to make sure - this form you're building, the user has to be logged in to use it right?"

So if the user shouldn't be logged in, what do i have to change?
healyhatman 02 Jul, 2018
Well if they're not logged in, why do you have a user id field in your save data action?

And no I've been operating under the assumption that the user isn't logged in so no misunderstanding on my side.
Denny87 02 Jul, 2018
This user id field is standard when you use the save data action.

Now everything works...

GREAT!
Denny87 02 Jul, 2018
Once again, thanks for helping me out!

One last question.
I've got an email action in my VERIFY Event after saving/updating my database.
I just want in my email all form fields to display -> i did the same in my email action in my SUBMIT event with {AUTO_FIELDS} .
But with my mail from my VERIFY Event it does not work.
Do you know why? Or is there a special way how to show all form fields in the email?
healyhatman 02 Jul, 2018
Because none of that data exists anymore, and unless you save it all to the database in SUBMIT and load it all in VERIFY you can't get it.

You could have the submit event display a second page (section) with a verification code text field and have them instead of clicking a link copy the code from the email to the text box and when they click submit it fires the VERIFY event.
Denny87 04 Jul, 2018
Thanks @healyhatman, but this will not be the solution we want to use.
So i have to do some custom code to read the data when the user is verified that to give it to our representative?
Denny87 04 Jul, 2018
Okay. So i will do input another read data action in my verify event after the save data.


Filtering settings -> Where conditions ->
verification:{value:null}
vid:1


Data settings - > Select type -> All matching records

And then in FOUND my Email action.
But what should i write in my body?
healyhatman 04 Jul, 2018
Whatever you want. No more free help.
Denny87 04 Jul, 2018
Ok Ok... Sorry that i'm asking😀
GreyHead 04 Jul, 2018
1 Likes
Hi Denny87,

Please stop and think through the logic of what you are doing here.

When the user clicks the verify link you can use a Read data action to load a record that matches the verify code. If a record is *not* found then 'do something'; if it *is* found then you have all the matching data loaded and can include that in an email.

Bob
GreyHead 04 Jul, 2018
Hi Denny,

Please try changing your site admin template to protostar if it is not already set and see if that makes a difference.

Bob
Denny87 04 Jul, 2018
Hi Bob,

I have already everything, i just was asking how i can call my data in my mail.
I did it with {var.pr:read_data33} and it works. But i want it to style like {AUTO_FIELDS}, and that is the only problem which i have.
GreyHead 05 Jul, 2018
Hi Denny,

No sign of a PM from you - did you send it to Admin instead of me?

Bob
Denny87 05 Jul, 2018
Hi Bob,

Sorry? What should i send to you?

Denny
This topic is locked and no more replies can be posted.