user registration /accounts/register username creation

Issue #1258 resolved
scrapper
created an issue

At the moment the name of a user is created out of first_name and last_name and email.

Lets add the possibility to create a individual username.

Could we add: {{{

!python

username = forms.RegexField(regex=r'^\w+$', max_length=30, widget=forms.TextInput(attrs=attrs_dict), label=_(u'username'))

}}}

to /../satchmo_store/accounts/forms.py class RegistrationForm.

and with a switch in settings.py such as:

'INDIVIDUAL_USERNAME': True/False,

we could activate the possibility to register with a random name rather than a first_name last_name email combination. i think this is more pretty and common than the actual way of creating a username.

other affected parts which need some changes would be:

{{{

!python

def save_contact(self, request): log.debug("Saving contact") data = self.cleaned_data password = data['password1'] email = data['email'] first_name = data['first_name'] last_name = data['last_name'] if settings.INDIVIDUAL_USERNAME: username = data['username'] else: username = generate_id(first_name, last_name, email) }}} in ../accounts/forms.py

affected Template: registration_form.html

if i am wrong, or if there is another solution to this one please correct me.

Thanks a lot scrapper

Comments (9)

  1. scrapper reporter

    Hello Chris,

    i have created a patch.txt. i hope its all right. Please check it and tell me what i should do better.

    what one has to do is add in settings.py:

    SATCHMO_SETTINGS = {
        'SHOP_BASE': '/online-shop',
        'MULTISHOP': False,
        'SSL': True,
    +   'NICKNAME' : True, # default = false. allow a random username instead of a username built out of first_name, last_name, email
    }
    

    NICKNAME: True. => an extra username_field will appear at registration_form.html. if commented# or False username creation as usual.

  2. scrapper reporter

    hello chris,

    i have changed it as you suggested to use config.py instead of SATCHMO_SETTING. now the user is able to check a box in admin settings.

    please verify thank you scrapper

  3. Log in to comment