Hi folks. I've a question that's come up on a number of my sites now. I'd like to be able to disallow users from selecting their own usernames, ever, even on signup. Instead, I want to expose various profile fields (or custom fields via form-alter if necessary) and then base the username off of that. E.g., first intial and last name, all lower-case. Does anyone know of an existing module or mechanism for that, or a common pattern that could be turned into a module?
There is code in the LDAP Provisioning module[1] which you could use to do this, though the whole module is only really useful if you're going to be tying into LDAP for authentication. Perhaps the user name assigning part could be extracted out?
Cheers, Dan
On Thu, Mar 13, 2008 at 8:59 AM, Larry Garfield larry@garfieldtech.com wrote:
Hi folks. I've a question that's come up on a number of my sites now. I'd like to be able to disallow users from selecting their own usernames, ever, even on signup. Instead, I want to expose various profile fields (or custom fields via form-alter if necessary) and then base the username off of that. E.g., first intial and last name, all lower-case. Does anyone know of an existing module or mechanism for that, or a common pattern that could be turned into a module?
-- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- [ Drupal support list | http://lists.drupal.org/ ]
On Thu, Mar 13, 2008 at 10:33 AM, Dan Karran dan@karran.net wrote:
There is code in the LDAP Provisioning module[1] which you could use to do this, though the whole module is only really useful if you're going to be tying into LDAP for authentication. Perhaps the user name assigning part could be extracted out?
[1] http://drupal.org/project/ldap_provisioning
Cheers, Dan
On Thu, Mar 13, 2008 at 8:59 AM, Larry Garfield larry@garfieldtech.com wrote:
Hi folks. I've a question that's come up on a number of my sites now. I'd like to be able to disallow users from selecting their own usernames, ever, even on signup. Instead, I want to expose various profile fields (or custom fields via form-alter if necessary) and then base the username off of that. E.g., first intial and last name, all lower-case. Does anyone know of an existing module or mechanism for that, or a common pattern that could be turned into a module?
-- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- [ Drupal support list | http://lists.drupal.org/ ]
-- Dan Karran dan@karran.net www.dankarran.com
On Thursday 13 March 2008, Dan Karran wrote:
On Thu, Mar 13, 2008 at 10:33 AM, Dan Karran dan@karran.net wrote:
There is code in the LDAP Provisioning module[1] which you could use to do this, though the whole module is only really useful if you're going to be tying into LDAP for authentication. Perhaps the user name assigning part could be extracted out?
Hm, possibly. I will have to investigate if it would be possible to pull that data out. I'm wary about digging code out of something as big as LDAP, though. :-)
Quoting Larry Garfield larry@garfieldtech.com:
Hi folks. I've a question that's come up on a number of my sites now. I'd like to be able to disallow users from selecting their own usernames, ever, even on signup. Instead, I want to expose various profile fields (or custom fields via form-alter if necessary) and then base the username off of that. E.g., first intial and last name, all lower-case. Does anyone know of an existing module or mechanism for that, or a common pattern that could be turned into a module?
Perhaps http://drupal.org/project/webserver_auth or http://drupal.org/project/logintoboggan; I haven't used them but the text of the system seems like it would be good places to get ideas.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Hi Larry,
Don't know how relevant this is, but we're in the process of writing some code around controlling user-names here as well for another SSO module (CAS). So my head is really around this problem right now.
For SSO solutions, we're implementing a username transformation hook in the sso module, which I know will not work for you (at least I don't think). But when using SSO solutions such as opened or cas are used, I've always been bothered that we create a user account before it's been approved in the registration process.
This is similar to the code in the LDAP module, but we're using a hook based approach to make it easier for other module developers to tie into. Given that, I don't think LDAP or CAS has the right solution for you.
Here's an idea for a module pattern that might work:
1. User the form_alter hook to change the field '#type' of the username to 'value' for the user_name form on a module.
2. Use the profile module to add the extra fields to the form.
3. In the form-alter hook, add form level validation fields to make sure that the generated username is unique, or guarantee uniqueness via some algorithm.
The implementation is left as an exercise for the user :). Does that approach make sense?
Dave
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Larry Garfield Sent: Thursday, March 13, 2008 2:00 AM To: support@drupal.org Subject: [support] Forcing username pattern
Hi folks. I've a question that's come up on a number of my sites now. I'd like to be able to disallow users from selecting their own usernames, ever, even on signup. Instead, I want to expose various profile fields (or custom fields via form-alter if necessary) and then base the username off of that. E.g., first intial and last name, all lower-case. Does anyone know of an existing module or mechanism for that, or a common pattern that could be
turned into a module?