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.
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.
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'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
We are using OpenERP 7 to manage leads within our organisation.
Leads are created by incoming emails. When assigning to a different sales person, the sales person gets an email with the original email and the from address is the original person that emailed it.
This is a problem because it looks like the customer emailed them directly and encourages the sales person to manage the lead from their email, rather than sending responses from the OpenERP system. How can I stop this email from being sent? I want to make my own template and use an automatic action to send a notification.
There is no automatic action sending this email. I believe it is somewhere in the python code.
You can check the automated actions from OpenERP in the Settings/Technical/Scheduler/Scheduled Actions menu. Look for the actions that read incoming e-mails and de-activate it.
In fact, I saw an option in the Settings / Configuration / Sales menu. At the bottom of the page, you must have a group called 'Emails Integration' and in this group, you must have a line with a checked checkbox with 'Create leads from incoming mails' as label.
Uncheck this box and click on 'Apply' button at the top of the page.
I found a hack solution which I hope someone can improve.
Basically the email comes in and adds an entry to the table mail_message. The type is set as "email" and this seems to be the issue. If I change it to "notification", the original email does not get sent to the newly assigned salesperson which is the behaviour that I want.
Create a server action on the incoming email server that executes the following python code:
cr.execute("UPDATE mail_message SET type = 'notification' WHERE model = 'crm.lead' AND res_id = %s AND type = 'email' ", (object.id, ))
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.