I'm using django-allauth and have enabled auto signup but I'm not sure how id decides on the username to use.
for example I just tested the auto signup with my Facebook account
my Facebook username is davidgriver
my Facebook first and last name are David Griver
django-allauth signed me up automatically under the username ddd
can someone explain to me why that happened and how I can make it either take the Facebook username or if that's not possible take the first and last name make them lowercase and remove the space
the google one is a bit smarter, it just takes the first name, but that's pretty bad because first names are common and not unique at all.
Ideally with google I would like to just take whatever is before the # symbol and use that.
allauth generates unique usernames by using generate_unique_username method defined in utils.py. Here is the link
Related
I have the logic for email verification, but I am not sure how to make it such that only after clicking the link on the verification email, the user is taken to the second page of the form, and only after filling the second part the user is saved.
I would say that much better idea is to save user to database anyway, but mark him as inactive (simple boolean field in model will be enough). Upon registration, before confirming email mark him as inactive and as soon as he confirms email and fills second part of your registration form that you mentioned change that boolean value to true. If you don't want to keep inactive users data in your database, you can set up for example cron, that will clean users that haven't confirmed their email for few days.
Visit the URL. I hope you get your answers. This appears to be duplicate of the below question asked on Stackoverflow itself
Check this.
I have two different steps and pass in the same variable there.
Scenario1:
Given the user lands on the page
When user enters a unique email address
Then user is redirected to checkout
Then user places the order
Scenario2:
Given the user lands on the same page
When the user enters the same email address above
Then user is presented with a modal window saying you already taken this offer
Is it possible to use the same generated unique email address to be used on the second scenario?
Why can't. You can use for any number of scenario's. As per scenario 1 steps, you already know the unique email address what you need to enter. Take this email address to the Hooks file and store it in one public static variable inside Before annotation. Later you can use same email for n number of scenario's using that public static variable.
If you need to use this email only for specific scenario's, add one tag to all scenario's which you need to use and tag it in Hooks file using Before({tags: tagName}). By this way, you can use this email address only for specific scenario's out of all.
Recently a requirement came where the customer is facing a issues while registering the user.
While filling up the registration form, there is field to populate the email address.
Here users are having email addresses like “xyz#abc.education”….after entering the other details and submitting the form, it is failing with the message that “Please enter a valid email address”.
Email address is perfectly valid but django is not allowing it to proceed.
Possible solutions:
Go and update the fields to store Charfield instead of EmailField.But not possible in my case.
In the django/code/validator.py ..i can go and modify the regex check to allow more than 6 characters (currently supporting {2,6}). But this is not a good idea to change the library code.
Please suggest.
I'd extend the default EmailField and change the validator. Something like this might work (not tested):
my_validate_email = django.core.validators.EmailValidator(whitelist=['abc.education'])
class MyEmailField(EmailField):
default_validators = [my_validate_email]
The relevant source code is EmailField and EmailValidator.
i am using the formhub.org server to submit form data via odk collect software.
i designed the xlsform and it works correctly.
the problem is that i wanna set a username and password for form submission so everybody cant submit from until he/she knows the password.
i dont know is it possible from odk collect application or somehow in my xlsform...
type name label
----------------------------------------------------------------------
text some_text 1. What is your full name?
select_multiple company some_company 2. Which telecomunication companies do you use?
select_one company best_company 3. Which one is the best?
thanks
easily i did it from my formhub.org account.
in account setting there is an option for authentication for mobile i just checked it.
I am going to let new users register on my service. Here is the way I think it should go:
1. User enters his email in a field and clicks Register button.
2. User receives a confirmation email with a link containing a verification code.
3. User goes by that link from the email message where he sees a message that his account is activated now.
So, the main point I am to figure out how to implement is the second one. How do I better generate that code? Should I generate it when the user clicks Register button and save it in the field, say "verification_code" near the field "email" and then when he goes to the verification link, compare the values? Then, if that's fine, clear the "verification_code" field and set "user_is_active" field to "True". Or may be I don't have to keep that code in the database at all, but make a just in time verification with some algorithm? May be there are other things I should consider?
I've found it useful to put a verification code in the database and use it as you've suggested. The same field can do double duty for e.g. password reset requests.
I also use an expiry timeout field, where registrations or password resets need to be dealt with by the user in a timely fashion.
There is already a project that does exactly what you want. It's called django-registration. I suggest using this project instead of rolling your own.
If you still want to do it yourself, then look at the code for django-registration. It has really good comments and is really a perfect app to learn from.