X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Use E-mail address instead of username 3.5.x & 4.0 (https://forum.x-cart.com/showthread.php?t=8809)

mvolpes 04-10-2007 01:12 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
apologies

2019 04-11-2007 03:08 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
x-light hear my cry :(

balinor 04-11-2007 04:02 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Thanks mvolpes.

X-Light 2019??

2019 04-11-2007 04:46 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
i need the 4.1.6 version of x-light username 2 email module :(

mvolpes 04-13-2007 06:45 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Hi all

Those implementing this becareful with this
ALTER TABLE `xcart_orders` ADD UNIQUE (
`email`
);

this will only allow a customer to make an order once from your site ...the next time they come they you will get a sql error..as it only allows the customers email address once..in the order table ..to reverse this use

ALTER TABLE `xcart_orders` DROP INDEX (
`email`
);

mvolpes 04-16-2007 03:01 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
any help with the error message?? When a insert of a duplicate email occurs I need some error handling..

asa 05-07-2007 04:55 AM

Use E-mail address instead of username
 
Hi

We want to use email as username. so far (prior to me) our company has used uname, now they asked me to bring some changes to user registration, one part of the change is to hide the uname and use email instead.



After reading the thread like http://forum.x-cart.com/showthread.php?t=8809&highlight=username+email



and some others;





I have changed it, now it seems to be registering ok but not editing/updating profile (it bounce back to profile page) has anyone done the same, if yes what files are to be changed?


OTHER ISSUES

I have changed the login.php file to accept email as username.
But I donâ–“t really know what other php files should I change in order for this to work for existing/new customers.

Email of new customer will be copied to the uname field of database. But, what other changes should I do so that when an existing customer forgets his/her password?

I have used different tpl files for customer bit because I wanted to still use the xcart procedure for admin bit.

Do I have to use separate php files too?

What other issues should take into consideration

any advice help will be appreciated

thanks



balinor 05-07-2007 06:14 AM

Re: Use E-mail address instead of username
 
I have moved your question to thread you reference instead of starting a new thread as it will be easier for people familiar with the mod to assist you.

summitmn 05-07-2007 01:52 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
I have also been looking at x-lite's mode...trying to use it on x-cart 4.1.6. Has anyone gotten it to work okay?

zefon 08-30-2007 08:22 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
When using this code in 4.1.8, if you try and login using an email address you get the following error message:

"Your account is temporarily disabled. Please contact the store administrator for details."


Code:

$user_data=func_query_first("select * from $sql_tbl[customers] where (login='$username' or email='$username') and usertype='$usertype' and status='Y'");

Anyone else had this problem and how did you fix it?

Plasticsteak1 09-03-2007 11:10 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
It's been a while since I made these changes.. but if I remember correctly I had to change the registration template a little bit by increasing the size of the input field for username(email address) on the registration page. I also found out later that I had to increase the size of the username field in the mySQL database.

~T

rhu 01-01-2008 07:26 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Has this been successfully applied to 4.1.9 ?

I noticed some users have been successful using post #64 for 4.1.3.

I want to give this a whirl in 4.1.9, but here are some of my concerns:

1. 'username' is VARCHAR(32) and it was noted in post #70 that there's a possibility of emails having more characters than that. (can this be fixed in phpMyAdmin by making 'username' have the same # of characters as 'email'?)

2. Post #85 notes that if you make 'email' unique in the DB, you get an sql error when user tries to place another order. Can this be confirmed or is there a fix for this?

ShishaPipeUK 01-20-2008 09:09 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by dsoong
This is quick work around I have


I don't know if your code will work the same. I am trying to fix a utf-8 user name problem I having so my code has change quite a bit.


Thanks for the code, works great. I have had a few phone calls saying they cant modify there customer account details so i have been doing this in admin for them, but now i put in the code below

Code:

$email = strtolower($email);
if (!isset($uname)) $uname = strtolower($email);


you supplied in the include/register.php section and now the customer can change there details withiout the access denied.

Just wanted to say thanks.

toolexperts 03-24-2008 05:01 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by xcell67
Hi,

I'm going to throw in my method for 4.1.0 rc4 in case some couldn't get the others to work.

include/register.php

find

Code:

$fillerror = (empty($uname) || !empty($error) || empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2));

replace with

Code:

$fillerror = (!empty($error) || empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2));

By deleting the error check for username, the cart will allow registrations without it.



Find
Code:

if (!@$error && $current_area == "C" && $active_modules["UPS_OnLine_Tools"]) {

Replace with
Code:

if (empty($uname)) $uname = $email;

if (!@$error && $current_area == "C" && $active_modules["UPS_OnLine_Tools"]) {


Since we're not allowing the customer to enter a username, the code above will automatically populate the username field with the email the customer supplies.

Find
Code:

$profile_values['email'] = $email;

Replace with
Code:

$profile_values['email'] = $email;
$profile_values['login'] = $email;


When the customer updates their email, their login will also reflect the change. There's only a slight problem with this. If the customer updates any of their other information, everything is fine. But when they update their email, they will get logged out. I don't know what causes the logout but their email/login still gets changed. What I did for my cart was add a little note "Note: If you change your email address, you will have to re-login for security purposes"

skin1/generate_required_fields_js.tpl

Delete this code to prevent check for uname

Code:

    ["uname", "{$lng.lbl_username|strip|replace:'"':'\"'}"],


skin1/main/register_account.tpl

You'll need to comment out the username fields:

Code:

{* Anonymous account *}
{*
<tr>
<td align="right">Email Address</td>
<td></td>
<td nowrap="nowrap">
<input type="text" name="uname" size="32" maxlength="32" value="{$userinfo.login}" />
</td>
</tr>
*}


Code:

{* NOT anonymous account *}

{*<tr>
<td align="right">Email Address</td>
<td class="Star">*</td>
<td nowrap="nowrap">
{if $userinfo.login ne "" || ($login eq $userinfo.uname && $login ne '')}
{$userinfo.login|default:$userinfo.uname}
{else}
<input type="text" id="uname" name="uname" size="32" maxlength="32" value="{if $userinfo.uname}{$userinfo.uname}{else}{$userinfo.login}{/if}" />
{if ($reg_error ne "" and $userinfo.uname eq "" and $userinfo.login eq "") or $reg_error eq "U"}<font class="Star">&lt;&lt;</font>{/if}
{/if}
</td>
</tr>
*}
<input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" />


With the above code, I had to take <input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" /> out of the commented out code block because xcart needs it to finish the registration process. You can leave everything else commented out.


All of the above satisfies your needs if you want the customer to use their email as their login. The extra stuff below will add in a second field for them to type their email twice for confirmation:

skin1/main/register_contact_info.tpl or wherever tpl you have your email field in

Add this under the intial email block:

Code:

<TR>
<TD align="right">Retype Email</TD>
<TD><font class=Star>*</font></TD>
<TD nowrap>
<input type="text" id="emailtwo" name="emailtwo" size=32 maxlength=128 value="{$userinfo.email}">
</TD>


skin1/check_email_script.js
Add this:

Code:

        if(document.registerform.emailtwo) {
      if(field.value==document.registerform.emailtwo.value){ }
    else{
        alert("Please reconfirm your email address. It does not match.");
        document.registerform.emailtwo.focus();
        document.registerform.emailtwo.select();
      err = true;
    }
  }


before return !err; at the end of the file

</TR> [/code]



Just freaking great.....Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/httpd/vhosts/toolexperts.com/httpdocs/register.php on line 201

toolexperts 03-24-2008 06:26 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
ok got it restored

toolexperts 03-24-2008 11:18 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
can someone help me? I restored my file back and i still get a message that there is an unexpected = in line 201....and this also occurs when attempting to checkout...

}
$fillerror (!empty($error) || empty($passwd1) || empty($passwd2) || $passwd1 ! $passwd2 || strlen($passwd1) > 64 || strlen($passwd2) > 64);

if (!$fillerror) {
if ($default_fields['b_country']['avail'] != 'Y') {
$b_country = $config['General']['default_country'];
if ($default_fields['s_country']['avail'] != 'Y')
$s_country = $config['General']['default_country'];
}

toolexperts 03-25-2008 05:04 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by B00MER
Use E-mail address instead of username for X-Cart 3.5.x & 4.0.

Let users use either their email address or username to login instead of JUST the username.

Edit include/login.php find:

Code:

$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE login='$username' AND usertype='$usertype' AND status='Y'");

Change to:

Code:

$user_data=func_query_first("select * from $sql_tbl[customers] where (login='$username' or email='$username') and usertype='$usertype' and status='Y'");

:!: Should work without troubles on 3.5.x and 4.0.x



I implemented this mod in 4.1.8, however, when I try to login, it tells me to contact the site admin as my account is temporarily disabled, and I can't seem to create new accounts

toolexperts 03-25-2008 05:35 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Do any of these methods work in 4.1.8?

4worx.com 05-08-2008 12:59 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Did somebody found a way to get the e-mail login working in 4.1.9? I have been trying to get it working but with little succes. I only get the message the account has been disabled by the admin. Any (quick) fix on top of all the suggestions here?

toolexperts 05-08-2008 04:52 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
the only way I made this work, was to change all references to for username to email address by using the template editor, then when i was importing i used the email address as the username. This is worling great at my site the only issue i have is i need to enable it so that an email with longer than 32 chracters can login, but noone has replied to my other post.

balinor 05-08-2008 05:25 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
The problem with this mod is anonymous customers - in order to order, they need to enter their e-mail address each time, and the system won't allow them to check out as their e-mail already exists in the system. I really don't recommend this method be used until a way is found to allow anon customers to repeat order.

4worx.com 05-08-2008 10:58 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
That is no problem in my case. We've set up the shop to only allow checkout for users that are logged in (upon customer request).

Is it still possible then to use the piece of code as described in post #90?

fmoses 05-20-2008 09:29 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by B00MER
Use E-mail address instead of username for X-Cart 3.5.x & 4.0.

Let users use either their email address or username to login instead of JUST the username.

Edit include/login.php find:

Code:

$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE login='$username' AND usertype='$usertype' AND status='Y'");

Change to:

Code:

$user_data=func_query_first("select * from $sql_tbl[customers] where (login='$username' or email='$username') and usertype='$usertype' and status='Y'");

:!: Should work without troubles on 3.5.x and 4.0.x


this is the code that i'm finding in my x-cart, can i still replace the code with the above code and still have it work, i tried changing it to that above using dreamweaver, and then i couldn't login at all, kept on saying invalid login. Should i be using something else to edit my files? New to this and fumbling my way around. the only difference is the WHERE BINARY STATEMENT Thanks

$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE BINARY login='$username' AND usertype='$usertype' AND status='Y'");

I had changed it to this
$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE BINARY (login='$username' or email='$username') AND usertype='$usertype' AND status='Y'");

4worx.com 05-21-2008 02:02 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Post #64 works fine!

JasonMiller1975 08-01-2008 10:05 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
I used a combination of posts #64, #67 and #78 to accomplish this. For my test accounts during install, I can still use my username to login with, but for all new customers, or pre-populated customers from an import, email address works for login now.

From a usability standpoint, people are becoming more expectant to use their email address for login purposes, not to mention they are more memorable than a sequentially generated naming convention created by a cart's admin.

Thanks for all your help guys!

Jason Miller

weckie 08-18-2008 10:07 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
I have this problem after i used the code from post #64.

"You have specified an incorrect user name. Only numbers (0-9) and lower-case letters (a-z) can be used. Please correct it. "

What to do?

skipmartin 10-17-2008 08:54 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
To get this to work in 4.1.x in login.php change:
Code:

$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE BINARY login='$username' AND usertype='$usertype' AND status='Y'");
to
Code:

$user_data = func_query_first("select * from $sql_tbl[customers] where (login='$username' or email='$username') and usertype='$usertype' and status='Y'");
$username = $user_date['username'];


The login script makes additional checks against the username, and it is still set as the email address which will cause those checks to fail until we reset the username to the the actual username.

JWait 10-18-2008 08:57 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by weckie
I have this problem after i used the code from post #64.

"You have specified an incorrect user name. Only numbers (0-9) and lower-case letters (a-z) can be used. Please correct it. "

What to do?


By default, version 4.1.11 and earlier versions of x-cart that have the the latest security patches do not allow anything other than numbers and lowercase letters to be used.
See the thread at http://forum.x-cart.com/showthread.php?t=41444 for a detailed explanation.

JWait 01-10-2009 06:30 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Is there any chance this has been updated to work with later versions of X-cart? What we would like to do is eliminate the "username" entirely and have the customer enter an email address and password only.

This would mean a change to register, login, and recover password areas of x-cart. It would also mean that anonymous checkout would have to be disabled.

Anyway, is this something that others would be interested in working on and implementing in 4.1.x and 4.2 versions of X-cart?

balinor 01-10-2009 07:25 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
http://forum.x-cart.com/showpost.php?p=215306&postcount=101

Also, the security patches that came out in the last few months prevent special characters such as @ in the username.

JWait 01-10-2009 09:02 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by balinor
http://forum.x-cart.com/showpost.php?p=215306&postcount=101

Also, the security patches that came out in the last few months prevent special characters such as @ in the username.


I realize the part about anonymous checkout (we disable it anyway), and the part about the security patches but have no idea why they made that change, do you?

balinor 01-10-2009 09:09 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
You disable anon checkout? Really? You aware that 1 in 4 e-commerce customers prefer NOT to create an account?

I have no idea on the security question, just being overly careful I think.

JWait 01-10-2009 09:34 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Anonymous is a total PITA.

It always seems the customers that did not want to create an account were the same ones that would call our 800 number asking about the status of their orders. The time and money spent on this "customer service" was determined to be too great to allow it to continue.

Since it is basically the difference of adding a username and password that is the difference, changing that to adding a password only, and using the email as the username seems like the reasonable solution. You can then add a "order history link" that you can use by entering your email address and (maybe) password. To recover the password, enter your email address..... simple!

We already have a "order tracking link" where all the customer has to do is enter their order number but you would be surprised how many people don't even know that.

There are lots of shopping carts that use this method, and I am surprised that X-cart does not have that ability.

Not allowing a email address instead of a username just seems kind of lame to me. There has to be some kind of work around that doesn't affect "security".

Doctored Locks 01-12-2009 09:25 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
We are also looking for this.

rsands 01-12-2009 04:35 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
come on x-cart...step up to the plate here...this layout of system usernames is dated...emails are used as usernames in 21st centry...this has 12 pages of people talking about this for such a simple mod on your part

pfarcus 01-16-2009 02:48 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
I have anonymous check out enabled but when i test it it asks for a user and password, what am i missing? some check box somewhere?

starwest 01-30-2009 01:44 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by rsands
come on x-cart...step up to the plate here...this layout of system usernames is dated...emails are used as usernames in 21st centry...this has 12 pages of people talking about this for such a simple mod on your part



Yes, this is definitely something I would LOVE to see X-Cart take care of. The current system of having to select both a username and enter your email is cumbersome and bound to fail for most individuals. Even before we allowed anonymous checkout, many of our customers created a new account each time they visited the site - no doubt because they had forgotten their username and/or password. If everything was tied to email, customers who register would be much more likely to use their existing account (or be reminded that they do have an existing account). Also, because X-Cart creates accounts for anonymous customers already, if they were based on email addresses it could simply append orders to the existing user account if an email were used again by an anonymouse customer.

Unfortunately, I imagine this may be too big of a change for them to consider in v4.1.x, which they're hoping to phase out in favor of v4.2.x. Still, it seems like this change would be EXTREMELY popular, so I'll cross my fingers and hope someone at X-Cart is listening.

milla_c 02-03-2009 04:54 AM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by starwest
Yes, this is definitely something I would LOVE to see X-Cart take care of. The current system of having to select both a username and enter your email is cumbersome and bound to fail for most individuals.


O yes, I also vote for this feature! AND for it to be in v4.1.x.
Please please please somebody at X-cart!!!

seaCOAST 02-15-2009 05:29 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Quote:

Originally Posted by B00MER
Use E-mail address instead of username for X-Cart 3.5.x & 4.0.

Let users use either their email address or username to login instead of JUST the username.

Edit include/login.php find:

Code:

$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE login='$username' AND usertype='$usertype' AND status='Y'");

Change to:

Code:

$user_data=func_query_first("select * from $sql_tbl[customers] where (login='$username' or email='$username') and usertype='$usertype' and status='Y'");

:!: Should work without troubles on 3.5.x and 4.0.x


I know this is an old post, but how can I make this work in 4.2.x?

The line I found in my login.php looks like this:


Code:

$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE BINARY LOWER(login)='$username' AND usertype='$usertype' AND status='Y'");


Thanks!

milla_c 02-19-2009 11:22 PM

Re: Use E-mail address instead of username 3.5.x & 4.0
 
Hope this helps someone...

First of all, I allowed users to have '@' and '.' in their usernames.
On registration I hid the 'username' field and had a note at the e-mail address that says your e-mail address will also be your username.
On submitting, the e-mail address is assigned to the username. (uname = email)
After successful submission, the e-mail field cannot be changed again by the user - if they want to edit the profile, they can, but the e-mail field is not edit-able. Yip, that means if your e-mail address changes you have to create a new user and profile, but that doesnt happen often.

After all that effort I stumbled across a much bigger issue... since I have x-cart pro and the providers also use their e-mail addresses as username, the providers must have another e-mail account ready to also register as customers, since they cannot use the same e-mail address for the username as customer.

So, after all my effort I am back at the usernames as it was, except that I still allow '@' and '.' in the username. :-(

Sometimes your learn from other's errors, sometimes they learn from yours!


All times are GMT -8. The time now is 11:19 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.