Seite 1 von 1

Email confirmation on customer registration

Verfasst: Fr 13. Jul 2012, 16:54
von Michael_S
Is there a way to use the we:tags to send an email when a customer registers to confirm his/her email address?

Thanks,

Michael.

Re: Email confirmation on customer registration

Verfasst: Fr 13. Jul 2012, 18:24
von netzlum
Hi Michael,
using only we:tags without PHP probably won't work.
I found an answer by Thomas to a similar question http://forum.webedition.org/viewtopic.p ... ten#p62810 : more or less translated: "after the customer has sent the form write the password to an extra field in the Customer module. Additionally a fill a field with a random value. Then send a mail to the customer including a link to a page where you check the params: the random value and maybe the ID of the customer. If the values are correct, copy the password from the etra field to the password field. This could be combined with an expiry date"
Maybe that gives you a hint.

Ludger

Re: Email confirmation on customer registration

Verfasst: Fr 13. Jul 2012, 20:33
von Michael_S
Hi Ludger,

Thanks, I was searching the forum but didn't find the post you mentioned, I will give it a go and will report back.

Thanks,

Michael.

Re: Email confirmation on customer registration

Verfasst: Sa 14. Jul 2012, 20:01
von Michael_S
Hi Ludger,

I have the suggested method working for a web user who has an active session and am using the session ID (we_cid) and the tag we:customer to present a form for the user to confirm the email address and to copy the real password from the temporary to the real field. This method is using we:tags without the need for custom php code.

I now need to do the same but without the session running, can I use we:saveRegisteredUser without an active session?

This is the code I'm testing without luck :(

Email link:

Code: Alles auswählen

http://_ _ _ _ _/authorise.php?we_cid=<we:sessionField type="print" name="ID" />
Form:

Code: Alles auswählen

<we:customer>
<we:form id="self" method="post" xml="true">	
	<input type="hidden" name="s[ID]" value="<we:var type="request" name="we_cid" />">
	<input id="Password" type="hidden" name="s[Password]" value="<we:field type="text" name="Customer_Password" />">
	<p><input type="submit" value="Confirm" /></p>
</we:form>
</we:customer>
MasterTemplate:

Code: Alles auswählen

<we:sessionStart />
<we:ifSelf id="201">
<we:saveRegisteredUser />
</we:ifSelf>

Re: Email confirmation on customer registration

Verfasst: So 15. Jul 2012, 13:35
von Michael_S
Ok, this is what I ended up with. It's based on we:tags and should be easy for most people to implement. If there are any issues or obvious improvements with this method please contribute.

The Customer Management module requires the following extra fields:

Customer_Email
Customer_Password
Customer_AuthCode
Customer_Auth

Master template (MasterTemplate.tmpl):

Code: Alles auswählen

<we:sessionStart />

<we:ifSelf id="200">
<we:saveRegisteredUser register="true" />
<we:sendMail id="202" subject="Confirm email address" recipient="Customer_Email" recipientBCC="[----------]" from="[----------]" mimetype="text/html" />
</we:ifSelf>

<we:ifSelf id="201">
<we:saveRegisteredUser />
</we:ifSelf>
Sign up page (Register.tmpl):

Code: Alles auswählen

<we:ifNotRegisteredUser>
<we:form id="200" method="post" xml="true">
	<we:sessionField type="hidden" name="ID" />
	<we:sessionField type="hidden" name="Username" autofill="true" />
	<we:sessionField type="hidden" name="Password" autofill="true" />
	<we:sessionField type="hidden" name="Customer_AuthCode" autofill="true" />
	<p><label for="Username">Email*:</label><br />
	<we:sessionField name="Customer_Email" id="Customer_Email" type="textinput" xml="true" /></p>
	<p><label for="Customer_Password">Password*:</label><br />
	<we:sessionField name="Customer_Password" id="Customer_Password" type="password" xml="true" /></p>
	<p>Required fields * <input type="submit" value="Register" /> <input type="reset" value="Reset" /></p>
</we:form>
</we:ifNotRegisteredUser>
Pre-confirmation page (ID: 200, PreConfirm.tmpl):

Code: Alles auswählen

<we:ifRegisteredUser>
<p>Please check your email for a message containing the account confirmation link.</p>
</we:ifRegisteredUser>
Confirmation email (ID:201, PreConfirmEmail.tmpl):

Code: Alles auswählen

Hi,<br /><br />
Thanks for signing up. Please confirm your registration by clicking on the link below:<br /><br />

http://<?php print $_SERVER['SERVER_NAME']; ?>/authorise.php?we_cid=<we:sessionField type="print" name="ID" />&auth=<we:sessionField type="print" name="Customer_AuthCode" /><br /><br />

When the confirmation page loads click on the confirm button to complete the process. After 
confirmation your account will be authorised and you will be able to access the downloadable 
files.
Post-confirm page (authorise.php, PostConfirm.tmpl):

Code: Alles auswählen

<we:setVar to="global" nameto="auth" from="request" namefrom="auth" />

<we:ifRegisteredUser>
<we:customer>
<we:ifVar name="Customer_AuthCode" match="\$auth" type="sessionfield" operator="equal">
<we:form id="self" method="post" xml="true">
	<we:sessionField type="hidden" name="ID" />
	<input id="Customer_Auth" type="hidden" name="s[Customer_Auth]" value="1">
	<input id="Username" type="hidden" name="s[Username]" value="<we:sessionField type="print" name="Customer_Email" />">
	<input id="Password" type="hidden" name="s[Password]" value="<we:sessionField type="print" name="Customer_Password" />">
	<p><input type="submit" value="Confirm" /></p>
</we:form>
<we:else />
Sorry, your authorisation code does not match our records. Please re-register and 
confirm your email address by clicking on the link sent to your email address.
</we:ifVar>
</we:customer>
</we:ifRegisteredUser>

<we:ifRegisteredUser permission="Customer_Auth" match="1" matchType="exact">
[download link]
</we:ifRegisteredUser>

Re: Email confirmation on customer registration

Verfasst: Do 4. Feb 2016, 12:50
von Karrahahu1
Additionally a fill a field with a random value. Then send a mail to the customer including a link to a page where you check the params:????