![]() |
Has anyone got this working with 4.017 ?
|
Seems to work fine on 4.0.17
|
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; 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; 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 *} Code:
{* NOT anonymous account *} 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> skin1/check_email_script.js Add this: Code:
if(document.registerform.emailtwo) { before return !err; at the end of the file </TR> [/code] |
xcell67 did you tried for final ver 4.1.0?:roll:
thank you. |
Works great in 4.0.18 - thanks!
|
Hello all! I need some expert advice. I am trying to get this patch to work.
ALTER TABLE `xcart_customers` ADD UNIQUE ( `email` ); it does seem to work (i patched through the xcart admin), however, when I try to create a account to test this, and use the same email as an existing account after i press submit I get this error on a blank white page: Code:
INVALID SQL: 1062 : Duplicate entry 'email@hotmail.com' for key 3 Also, there are not duplicate emails in the database. then it goes to "user created" dialog message but upon checking in the admin the user is not actually created. Any insight about this error. Any insight please let me know.. :-( |
Make sure you don't have the same email in the database for two different accounts.
|
Nope, there are no duplicate emails. Any other ideas?
|
Quote:
Thanks. |
any1? :(
|
Wouldn't it be better to update the database with a unique index on e-mail and usertype?
I mean something like Code:
ALTER TABLE xcart_customers ADD UNIQUE (usertype, email); So it would be possible to have a provider, admin and customer account (for testing) on the same e-mail address. What do you think? Hope to hear from you soon. Best wishes, Marc |
the code in 4.1.2 is a little different
$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE BINARY login='$username' AND usertype='$usertype' AND status='Y'");
Note there's a BINARY there. I followed boomer's instructions, but it seems it doesn't work. Anyone can give some hint? thanks! |
Re: the code in 4.1.2 is a little different
Quote:
4.1.2 It seems a BINARY condition was added to help compare bytes codes vs charachter as is, the mod should still work up to 4.1.1 as-is, however here is the 4.1.2 code for include/login.php: Code:
$user_data = func_query_first("SELECT * FROM $sql_tbl[customers] WHERE BINARY (login='$username' OR email='$username') AND usertype='$usertype' AND status='Y'"); :arrow: http://mysql.com/doc/refman/5.0/en/charset-binary-op.html |
BINARY only makes it case-sensitive even if the charset isn't case-sensitive right? If we are comparing emails, most of the time we can get away without being case-sensitive (though technically emails are case-sensitive but are not generally enforced). This was in the latest v4.0.19 patch but I didn't include it.
|
Re: Use E-mail address instead of username 3.5.x & 4.0
I did this on my 4.1.3 install as descibed by xcell67 on page4 of this thread and it seemed to work OK, but when testing some other things I registered a new user during checkout, this user´s login wasn´t the e-mail address, it was anonymous-4.
Can anyone reproduce this or did I miss something when performing the mod? thanks |
Re: Use E-mail address instead of username 3.5.x & 4.0
Anyone know anything about the above Post? We'd also like to have this since I don't like the idea of people being able to get Account details of 5 people using the same e-mail address.
Cheers. |
Re: Use E-mail address instead of username 3.5.x & 4.0
Hello,
Did anyone get this to works correctly on 4.1.3 yet? I would like to implement it into our site if it will work with our version. Thanks! |
Re: Use E-mail address instead of username 3.5.x & 4.0
I just disabled anonymous orders, everyhing else works fine.
|
Re: Use E-mail address instead of username 3.5.x & 4.0
I've seen alot of elaborate coding to accomplish what seems to be an easy problem to solve. It's entirely possible that I'm missing some things but this is how I force the username = email address issue.
I set the email field to "Unique" and added the following code at the top of include/register.php Quote:
|
Re: Use E-mail address instead of username 3.5.x & 4.0
tpaul,
What version of x-cart are using? Quote:
|
Re: Use E-mail address instead of username 3.5.x & 4.0
posting removed. see my other posting below.
|
Re: Use E-mail address instead of username 3.5.x & 4.0
When you say you set the email field to "unique", what exactly do you mean and how do I do that?
Quote:
|
Re: Use E-mail address instead of username 3.5.x & 4.0
Quote:
Quote:
|
Re: Use E-mail address instead of username 3.5.x & 4.0
This is how I forced my users to use their email address as their username. It allows the user to make changes to their email address after registering but the username will never change.
Use PHPmySQL to set the email field to "Unique" (in the xcart_customers table) Add the following code at the top of include/register.php (this will force all email addresses and usernames to be lowercase) Quote:
Add the following code to the bottom of /check_email_script.tpl Quote:
Find the code below in /main/register_account.tpl and add the below bolded javascript property to code below: (whenever the user clicks on the "username" or "password" fields (when registering or updating info) the "username" field and "uname" variable get set to equal whatever is in the "email" field. This works pretty well. There is one small catch though, after registering if the user changes their email and clicks in the "password" field(s) the script will change the hidden "uname" variable to equal the new email address and will cause an access denied error upon submit because the script is trying to reset the username as well which is not allowed. If you're lazy you could just use the OnFocusOut javascript control only on the "uname" text fields.) Quote:
|
Re: use email rather username
Thank you for that. Worked like a charm!!!
|
Re: Use E-mail address instead of username 3.5.x & 4.0
Yes I got it to work.
|
Re: Use E-mail address instead of username 3.5.x & 4.0
On the Code below (in /main/register_account.tpl) I changed <input type="text" under the {else} to <input type="hidden" so people can't type anything into the Username. Then just put a note at the top saying that the e-mail address will be the Username.
Code:
{* NOT anonymous account *} |
Re: Use E-mail address instead of username 3.5.x & 4.0
#43,
xcell67 ... your mod worked for me on testing 4.1.6. Thanks! Only addition would be the change the language on lbl_username_n_password , which I did to say "Password (your user name is your email address)" |
Re: Use E-mail address instead of username 3.5.x & 4.0
1 Attachment(s)
The attached .jpg shows how I have the Registration Help text at the top of the Register Page under 'Create Account'.
Under the red line (I cut the page down so it would fit on the Forums) I have shown how the Contact Information part of the page looks. I think it's pretty good, any suggestions? Also, I'm wanting to make it a requirement that Passwords are at least 6 characters long, how do I do this? |
Re: it is wrong to do in this way!!
i try the #43 method.
however, i found that the logic is wrong. the method in #43 is simply replace the field username by the user email. however, it will cause a BIG problem if buyer made an order, then change the email address. as there is many foreign key "login" in other tables. it will break all the consistent of the database. 2nd problem is, the login field only have VARCHAR(32) however, in my 5000 custmers reocrd, there are more than 200 ppl having 32-38 characters in the email. so, if you simply replace the "login" by using the "email" buyer will never able to login I am sorry that I don't know how to do in programming. But it is suggested to modify to do in this way: 1. mask the login field in the signup, and contact field (may be display as "same as email address") 2.check the email address exist, if exist, display the error message. 3. when new buyer registered, simply assign "1" to the "login" name for the frist buyer. for the 2nd+ buyer, query the database, get MAX(login)+1 Now, the real login name for the buyer will be "1", "2", "3" 3. change the login form, when ppl type the email address in the login field. the x-cart backend simply find the REAL username number by using the email address. in this case, even the buyer change the email address AFTER sign up or ordered something. there real login name is still NOT change. what have been changed is only the email. any comment is welcome. hope this can help ppl to find the solution. as i have ask x-cart, they ask for USD200 for this mod.... i am thinking change to ***** for this reason. |
Re: Use E-mail address instead of username 3.5.x & 4.0
Great! Will these mods work on 4.1.3?
|
Re: Use E-mail address instead of username 3.5.x & 4.0
I found the Code on Post #64 worked fine on my 4.1.x Install (I can't remember exactly what Version I was using at the time) but it should work fine on 4.1.3.
|
Re: Use E-mail address instead of username 3.5.x & 4.0
Will this work with version 4.1.6
|
Re: Use E-mail address instead of username 3.5.x & 4.0
It works on my Version 4.1.6. :)
|
Re: Use E-mail address instead of username 3.5.x & 4.0
can someone please , post the modded full working version for 4.1.6
thnx |
Re: Use E-mail address instead of username 3.5.x & 4.0
2019: Click here.
|
Re: Use E-mail address instead of username 3.5.x & 4.0
Quote:
This is my change inspired by #64. Basically the same but I like to keep all changes in one block. They are inserted after if you are using 4.1.6 Quote:
Next, how do we change the user name in DB? |
Re: Use E-mail address instead of username 3.5.x & 4.0
Quote:
This is quick work around I have Quote:
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. |
Re: Use E-mail address instead of username 3.5.x & 4.0
Hi guys
I implemented the very first mod ..and works a treat ...I am after some nice error handling for the sql insert/update for the register.php....any help?? I like a user to have a user name just a simple option to log in with the email address as was the original post's intention... Any help would be greatly appreciated |
Re: Use E-mail address instead of username 3.5.x & 4.0
Hi mvolpes, can you please update your signature with your X-Cart version? Really tough to answer posts when we don't know exactly what version you are using. Thanks :)
|
All times are GMT -8. The time now is 11:20 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.