Forums / Developer / No username required for user account use email only

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...

eZ debug

Timing: Jan 19 2025 00:18:04
Script start
Timing: Jan 19 2025 00:18:04
Module start 'content'
Timing: Jan 19 2025 00:18:05
Module end 'content'
Timing: Jan 19 2025 00:18:05
Script end

Main resources:

Total runtime0.9330 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0087 587.8594180.8125
Module start 'content' 0.00870.7359 768.6719636.8281
Module end 'content' 0.74450.1884 1,405.5000341.0547
Script end 0.9330  1,746.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.4793210.0002
Check MTime0.00180.1883210.0001
Mysql Total
Database connection0.00080.084210.0008
Mysqli_queries0.843090.35192050.0041
Looping result0.00320.34622030.0000
Template Total0.900296.520.4501
Template load0.00180.196120.0009
Template processing0.898396.280620.4492
Template load and register function0.00010.010510.0001
states
state_id_array0.00130.141510.0013
state_identifier_array0.00150.161320.0008
Override
Cache load0.00160.1746570.0000
Sytem overhead
Fetch class attribute can translate value0.00260.274440.0006
Fetch class attribute name0.00110.116390.0001
XML
Image XML parsing0.00320.340840.0008
class_abstraction
Instantiating content class attribute0.00000.0038120.0000
General
dbfile0.00380.4086390.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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