Email Addresses with Apostrophes?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
b3n
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Tue Sep 07, 2010 9:02 am

Email Addresses with Apostrophes?

Post by b3n » Wed Dec 21, 2011 6:37 am

I recently learned that email addresses with apostrophes in are perfectly valid (according to the RFC document which covers such things) however Able doesn't seem to like them - attempting to sign in with an email with an apostrophe just returns a user not found message. Has anyone had any experience with this?

Stepping through the login process I can see that the (first) failing function is UserDataSource.LoadForUserName() so I'm guessing I'll need to modify the core Able code? We have the source available, so that's not too bad, but if anyone has any advice on this before I set off on an impossible adventure I'd appreciate it!

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Email Addresses with Apostrophes?

Post by jmestep » Wed Dec 21, 2011 8:54 am

You could try replacing Able's email validator with a custom one using a different Regex. This is what Able uses:

Code: Select all

    public static string EmailRegex
        {
            get
            {
                return @"^[A-Za-z0-9._%+-]+@([A-Za-z0-9-]+\.)+[A-Za-z]{2,6}$";
            }
        }
You might also want to add Able's safe sql string code around the input, replacing the single apostrophe with two to guard against sql injection attacks.
public static string SafeSqlString(string str)
{
if (str == null)
{
return string.Empty;
}

return str.Replace("'", "''");
}

For example, it would be something like StringHelper.SafeSqlString(AddEmail.Text)
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
crockettdunn
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 105
Joined: Sun Oct 26, 2008 6:32 pm
Contact:

Re: Email Addresses with Apostrophes?

Post by crockettdunn » Thu Dec 19, 2013 9:33 am

Did this work out for you? I've just run into email-address-with-apostrophe problems, too.

I'll search my files for, "public static string EmailRegex." I'd certainly appreciate it if anyone could point me to the specific file to get started.

Thanks!

Post Reply