Advertisement:

Author Topic: User must enter email twice during registration  (Read 58725 times)

Offline Ride

  • Jr. Member
  • **
  • Posts: 185
  • Gender: Male
    • Southern California Snowboarding Forum
User must enter email twice during registration
« on: August 25, 2004, 01:14:37 PM »
I get a lot of bounced emails with people registering with things like "joebob@hotmal.com" or "joebob@yaho.com."   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.

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: User must enter email twice during registration
« Reply #1 on: August 25, 2004, 05:05:53 PM »
Easy enough to do...

In Themes/default/Register.template.php

Find
Code: [Select]
// 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
Code: [Select]
<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:
Code: [Select]
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:
Code: [Select]

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

That should do it.
« Last Edit: August 25, 2004, 05:08:48 PM by Oldiesmann »
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline Ride

  • Jr. Member
  • **
  • Posts: 185
  • Gender: Male
    • Southern California Snowboarding Forum
Re: User must enter email twice during registration
« Reply #2 on: August 25, 2004, 08:17:06 PM »
Thank you very much!

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: User must enter email twice during registration
« Reply #3 on: August 25, 2004, 11:43:55 PM »
Also note that people can go back and change their email address....

-[Unknown]

williammc

  • Guest
Re: User must enter email twice during registration
« Reply #4 on: August 26, 2004, 12:16:19 AM »
A nice little addition there, been added on my forum, thanks Oldiesmann.

Offline madfiddler

  • Full Member
  • ***
  • Posts: 667
  • Gender: Male
  • Flit Kills Moths
    • madfiddler
Re: User must enter email twice during registration
« Reply #5 on: August 27, 2004, 08:57:23 PM »
Thanks. I'm getting a load of members who apparently can't type their email address correctly...

Offline Tristan Perry

  • SMF Hero
  • ******
  • Posts: 2,498
  • Gender: Male
    • Tristan Perry
Re: User must enter email twice during registration
« Reply #6 on: August 30, 2004, 10:01:48 AM »
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:

Quote
Notice: 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?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: User must enter email twice during registration
« Reply #7 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]

Offline Tristan Perry

  • SMF Hero
  • ******
  • Posts: 2,498
  • Gender: Male
    • Tristan Perry
Re: User must enter email twice during registration
« Reply #8 on: August 31, 2004, 04:59:25 AM »
Find:
fatal_lang_error('Email addresses aren\'t the same.', false);

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

-[Unknown]
Thanks  :)

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: User must enter email twice during registration
« Reply #9 on: September 02, 2005, 03:14:32 PM »
is this included in 1.1 beta 3 ?
if not, how can we do it?
Home of Elmacik

Offline Anakin_holland

  • Jr. Member
  • **
  • Posts: 237
  • Gender: Male
  • universe malfunction, restart reality.sys ?
Re: User must enter email twice during registration
« Reply #10 on: September 02, 2005, 04:01:38 PM »
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

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: User must enter email twice during registration
« Reply #11 on: September 02, 2005, 04:04: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.



Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: User must enter email twice during registration
« Reply #12 on: September 02, 2005, 04:16:58 PM »
didnt work for 1.1 beta 3
Home of Elmacik

Offline modtang

  • Semi-Newbie
  • *
  • Posts: 33
  • Gender: Female
  • omgz teh n00b
Re: User must enter email twice during registration
« Reply #13 on: September 11, 2005, 04:03:25 AM »
This is simple to install and a good idea. Works fine on 1.0.5. :)

Offline Wounded Knee

  • Semi-Newbie
  • *
  • Posts: 35
  • Gender: Male
Re: User must enter email twice during registration
« Reply #14 on: October 15, 2005, 04:53:40 PM »
work in 1.1 RC1?

Offline houston

  • Jr. Member
  • **
  • Posts: 149
Re: User must enter email twice during registration
« Reply #15 on: November 17, 2005, 10:16:35 PM »
Can't find

   
Code: [Select]
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

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 29,934
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: User must enter email twice during registration
« Reply #16 on: November 27, 2005, 01:56:42 AM »
Can't find

   
Code: [Select]
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:
Code: [Select]
// 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:
Code: [Select]
<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:
Code: [Select]
if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value)
{
alert("', $txt['register_passwords_differ_js'], '");
return false;
}

Replace With:
Code: [Select]
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
Support the SMF Support team!
Profiles:
GitHub

Offline rokit

  • Semi-Newbie
  • *
  • Posts: 27
  • Gender: Male
Re: User must enter email twice during registration
« Reply #17 on: March 02, 2006, 04:44:55 PM »
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. =_=

Offline Ganghiss

  • Newbie
  • *
  • Posts: 9
Re: User must enter email twice during registration
« Reply #18 on: April 17, 2006, 10:39:17 AM »
Quote
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'], '");

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

Offline Ganghiss

  • Newbie
  • *
  • Posts: 9
Re: User must enter email twice during registration
« Reply #19 on: April 18, 2006, 05:25:40 PM »
Although it seems just adding the alerts creates a parsing error. I may have tossed them into login.english.php wrong.