how to set username and password for xlsform - python

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.

Related

How do I check for typos in a user submitted domain name?

Basically, I'm trying to automatically correct user submitted emails with typos that are only a few letters off. For instance, if a user accidentally submits gamil.com or gmial.com instead of gmail.com, I would like to correct it. What's a good method for handling this task?
Use pymailcheck:
https://pypi.python.org/pypi/pymailcheck/1.0.0 or https://github.com/dbarlett/pymailcheck
You can use it to check the email-addresses entered by users and suggest the correctly written email-address.

Django(1.3.1) email validation is failing for valid email address like "xxx#xxx.education"

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.

how does django-allauth generate the username?

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

Stop Automatic Lead Email

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, ))

What is the best practice for registering a new user in my case?

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.

Categories

Resources