News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

User must enter email twice during registration

Started by Ride, August 25, 2004, 01:14:37 PM

Previous topic - Next topic

Ride

I get a lot of bounced emails with people registering with things like "[email protected]" or "[email protected]."   Simple typos.  It'd be nice to make them enter their email twice and verify it's the same.  This would cut down on registration mistakes.  I did a search for this but didn't find anything.

Oldiesmann

#1
Easy enough to do...

In Themes/default/Register.template.php

Find
// Are they allowed to hide their email?
if ($context['allow_hide_email'])
echo '
<input type="checkbox" name="hideEmail" class="check" id="hideEmail" /> <label for="hideEmail">', $txt[721], '</label>';

echo '
</td>
</tr><tr>


Add after
<td width="40%">
<b>Verify ', $txt[69], ':</b>
<div class="smalltext">This is just to make sure you didn\'t mis-type your email address...</div>
</td>
<td>
<input type="text" name="email2" size="30" />
</td>
</tr><tr>


In Sources/Register.php

Find:
if (empty($_POST['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error(sprintf($txt[500], $_POST['user']), false);


Add after:


if (empty($_POST['email2']) || $_POST['email2'] != $_POST['email'])
fatal_lang_error('Email addresses aren\'t the same.', false);


That should do it.
Michael Eshom
Christian Metal Fans


[Unknown]

Also note that people can go back and change their email address....

-[Unknown]

williammc

A nice little addition there, been added on my forum, thanks Oldiesmann.

madfiddler

Thanks. I'm getting a load of members who apparently can't type their email address correctly...

Tristan Perry

Hi all,
I've tried to add this but when I test it out I get the following error at the top of the page:

QuoteNotice: Undefined index: Email addresses aren't the same. in /home/tauonli/public_html/forums/Sources/Errors.php on line 233

And the 'An Error Has Occurred!' box has nothing in it...any help?

[Unknown]

Find:
fatal_lang_error('Email addresses aren\'t the same.', false);

Replace:
fatal_error('Email addresses aren\'t the same.', false);

-[Unknown]

Tristan Perry

Quote from: [Unknown] on August 30, 2004, 02:51:45 PM
Find:
fatal_lang_error('Email addresses aren\'t the same.', false);

Replace:
fatal_error('Email addresses aren\'t the same.', false);

-[Unknown]
Thanks  :)

Elmacik

is this included in 1.1 beta 3 ?
if not, how can we do it?
Home of Elmacik

Anakin_holland

Great solution Oldiesmann, nice trouble-shooting [Unknown] ! 8)

Implemented it right away!

@elmacik, You can check if it's inlcuded, by taking a look at the registration-procedure at this very board? If it isn't you could take a look at the files an see if they look the same as what Oldiesmann posted? If it is, it probably works the same as well?

Greetz!

Anakin

1MileCrash

Quote from: [Unknown] on August 25, 2004, 11:43:55 PM
Also note that people can go back and change their email address....

-[Unknown]

even if email activation is required, and theyre not activated?
The only thing php can't do is tell you how much milk is left in the fridge.



Elmacik

Home of Elmacik

modtang

This is simple to install and a good idea. Works fine on 1.0.5. :)


houston

Can't find

   if (empty($_POST['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error(sprintf($txt[500], $_POST['user']), false);


In Sources/Register.php of 1.1 rc1

SleePy

Quote from: houston on November 17, 2005, 10:16:35 PM
Can't find

   if (empty($_POST['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error(sprintf($txt[500], $_POST['user']), false);


In Sources/Register.php of 1.1 rc1

neither could i. but i went about it a different way


In Themes/default/Register.template.php

Find:
// Are they allowed to hide their email?
if ($context['allow_hide_email'])
echo '
<input type="checkbox" name="hideEmail" class="check" id="hideEmail" /> <label for="hideEmail">', $txt[721], '</label>';

echo '
</td>
</tr><tr>


Add After:
<td width="40%">
<b>Verify ', $txt[69], ':</b>
<div class="smalltext">This is just to make sure you didn\'t mis-type your email address...</div>
</td>
<td>
<input type="text" name="email2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr><tr>

Note: I added the tabindex so when people are registering and just tabing though the fields it doesnt get missed.
Find:

if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value)
{
alert("', $txt['register_passwords_differ_js'], '");
return false;
}


Replace With:

if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value && document.forms.creator.email.value != document.forms.creator.email2.value)
{
alert("The E-Mail Address you have entered to not Match. The Passwords You have Entered do not Match. Please Check them again to make sure they are correct.");
return false;
}

if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value)
{
alert("', $txt['register_passwords_differ_js'], '");
return false;
}


if (document.forms.creator.email.value != document.forms.creator.email2.value)
{
alert("The E-Mail Address you have Entered are NOT the same. Please Check them to make sure they are correct");
return false;
}';


that is how i was able to get it working
i do not know were $txt['register_passwords_differ_js'] is. i thought it would be in errors.english.php but it is not. if you know were it is. please tell me and you can add your alert there using
         alert("', $txt['register_emails_differ_js'], '");
and
         alert("', $txt['register_passwords_emails_differ_js'], '");

Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

rokit

Thanks so much for this.  I get the same problem that you guys have encountered.  Member send me emails or post threads saying they can't log in because they never receieved an activation email. =_=

Ganghiss

Quotei do not know were $txt['register_passwords_differ_js'] is. i thought it would be in errors.english.php but it is not. if you know were it is. please tell me and you can add your alert there using
         alert("', $txt['register_emails_differ_js'], '");
and
         alert("', $txt['register_passwords_emails_differ_js'], '");

SleePy, you can find $txt['register_passwords_differ_js'] in Login.english.php located in Themes/default/languages/.

Ganghiss

Although it seems just adding the alerts creates a parsing error. I may have tossed them into login.english.php wrong.

Advertisement: