No username required for user account use email only

Author Message

Nathan Kelly

Thursday 01 March 2007 8:16:46 pm

Hi all,

I've had a request from a client to remove the username from user accounts and registration so that users don't have to come up with a unique username. They would prefer that the user sign in with an email address as their username instead.

I know I can allow users to sign with their email but they still need to create a unique username at registration time, we have had many users complaining that it takes them more than on attempt to sign up due to the username having to be unique a common comment is "my name is John why can't I use John as my username (this place sux)?"

Not really the kind of feedback the client wanted...

There is a setting for unique email in site.ini but nothing for unique username, which would be really handy right now.

[UserSettings]
AuthenticateMatch=login;email
RequireUniqueEmail=true

the AuthenicateMatch also didn't seem to make any difference when I changed it to email only (other than the fact that it crashed the site).

I've been looking for a solution to this but so far haven't found one that doesn't involve hacking the kernel, which I would like to avoid at all costs. (http://ez.no/community/forum/developer/users_without_login)

Is there a way to allow users to sign up without having to enter a username?

Any help is appreciated, I'm copping a lot of flack from the client at the moment and I really need to find a solution as quickly as possible.

Cheers.

Pardon me while I burst into flames...

Bruce Morrison

Thursday 01 March 2007 8:44:57 pm

Hi Nathan

No real quick fix for this. What you can do without hacking the kernel is hide the username form element in the signup and set the value to be the attribute_id ("user"+ attribute_id might be better esp. if there is a length limit on usernames)

standard/templates/content/datatype/edit/ezuser.tpl

...
{* Username. *}
<div class="element">
    {section show=$attribute.content.has_stored_login}
        <input type="hidden" name="{$attribute_base}_data_user_login_{$attribute.id}_stored_login" size="16" value="{$attribute.content.login}" disabled="disabled" />
        <input type="hidden" name="{$attribute_base}_data_user_login_{$attribute.id}" value="{$attribute.content.login}" />
    {section-else}
        <input id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_login" class="ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}" type="hidden" name="{$attribute_base}_data_user_login_{$attribute.id}" size="16" value="user{$attribute.content.id}" />
    {/section}
</div>
...

To do this completly you'd need to override all templates that use the username and hide/remove it.

Hope this helps.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Nathan Kelly

Thursday 01 March 2007 8:59:33 pm

Thanks Bruce,

I actually had this in mind and I started to test it out, I think is the cleanest fix for my problem at this stage because it only involves overriding templates as opposed to hacking.

I'm assuming I'll need to override the Admin templates too?

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Thursday 01 March 2007 9:27:18 pm

Works like a charm, but if anyone else is looking at Bruce's example there is one change needed:

Change:
value="user{$attribute.content.id}"
To:
value="user{$attribute.content.contentobject_id}"

Thanks Bruce, you just saved my hide.

Cheers!

Pardon me while I burst into flames...

Bruce Morrison

Thursday 01 March 2007 11:05:21 pm

Hi Nathan

Opps. I had meant to write:

value="user{$attribute.id}"

as

value="user{$attribute.content.contentobject_id}"

Will cause issues if for some reason there are multiple user attributes as part of the one content object (umlikely I know)

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Fabricio Guerrero

Monday 05 March 2007 9:25:23 am

hi...

changing this post just a bit...

i have a request from a client wanting us to remove passwords and only want users to have to register/login with an username.

is their a clean way to go about this? or is this some dirty kernel hacking?

regarding no username... i had a similar request over a year ago from another client and what i did i guess is a bit dirty.. but i made the user field hidden and on the onSubmit method via javascript copied over the email into the user account field(hidden field)..

this way username and email was always the same and easy to remember.

http://www.solobromasychistes.com <<Joomla Site :P
http://www.recipesforhealthyfood.com/ <<Drupal Site :P
http://www.ezforge.com/ <<future ezCommunity, Articles, forums and more...

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 21:12:48
Script start
Timing: Jan 18 2025 21:12:48
Module start 'layout'
Timing: Jan 18 2025 21:12:48
Module start 'content'
Timing: Jan 18 2025 21:12:49
Module end 'content'
Timing: Jan 18 2025 21:12:49
Script end

Main resources:

Total runtime0.9268 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.0625152.6406
Module start 'layout' 0.00470.0031 740.703139.4766
Module start 'content' 0.00770.9174 780.1797635.7344
Module end 'content' 0.92510.0016 1,415.914120.1250
Script end 0.9267  1,436.0391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3352160.0002
Check MTime0.00130.1409160.0001
Mysql Total
Database connection0.00060.069210.0006
Mysqli_queries0.846591.3367680.0124
Looping result0.00070.0761660.0000
Template Total0.894696.520.4473
Template load0.00210.226520.0010
Template processing0.892596.305320.4463
Template load and register function0.00010.010710.0001
states
state_id_array0.00110.120010.0011
state_identifier_array0.00150.157120.0007
Override
Cache load0.00190.2068570.0000
Sytem overhead
Fetch class attribute can translate value0.00090.096830.0003
Fetch class attribute name0.00140.155090.0002
XML
Image XML parsing0.00170.181230.0006
class_abstraction
Instantiating content class attribute0.00000.0026120.0000
General
dbfile0.00120.1252280.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 34
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs