Allows users to login with email as well as username.
Project description
ckanext-emailasusername
We have have found that many of our users quickly forget their CKAN username. We have also observed several users assume they should use their email to login. This fails with a bad login error message, which causes some confusion.
This CKAN extension allows users to login or reset their password with either their email address or their username. It doesn’t do away with the username but just offers the option to use email instead.
Out of the box, CKAN allows multiple accounts to be registered with the same email address. This causes a problem for using email to identify the user. This extension therefore adds a validator to the registration form to stop new accounts being created if there already exists an account with the same email.
If multiple accounts are registered to your email, then identifying the user by email fails - you must use your username to login/reset your password instead. It’s recommended, if feasible, to work with your userbase to phase out multiple accounts with the same email.
Important Installing this extension requires editing CKAN’s who.ini file to point to the new authenticator.py file provided by this module. Make sure you complete complete step 4 in the installation instructions below.
Requirements
This extension has been built and tested with CKAN 2.8.2.
Installation
To install ckanext-emailasusername:
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
Install the ckanext-emailasusername Python package into your virtual environment:
pip install ckanext-emailasusername
Add emailasusername to the ckan.plugins setting in your CKAN config file (by default the config file is located at /etc/ckan/default/production.ini).
Configure CKAN to use the authenticator provided in this plugin. Add ckanext.emailasusername.authenticator:EmailAsUsernameAuthenticator to the [authenticators] plugins configuration in CKAN’s who.ini file. In ckan core, thise who.ini file is stored in ckan/ckan/config and linked to from ckan/:
[authenticators] plugins = auth_tkt ckanext.emailasusername.authenticator:EmailAsUsernameAuthenticator
Restart CKAN. For example if you’ve deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
Running the Tests
To run the tests, do:
nosetests --nologcapture --with-pylons=test.ini
To run the tests and produce a coverage report, first make sure you have coverage installed in your virtualenv (pip install coverage) then run:
nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.emailasusername --cover-inclusive --cover-erase --cover-tests
Releasing a New Version of ckanext-emailasusername
ckanext-emailasusername is availabe on PyPI as https://pypi.python.org/pypi/ckanext-emailasusername. To publish a new version to PyPI follow these steps:
Update the version number in the setup.py file. See PEP 440 for how to choose version numbers.
Create a source distribution of the new version:
python setup.py sdist bdist_wheel
Upload the source distribution to PyPI:
python -m twine upload dist/*
Tag the new release of the project on GitHub with the version number from the setup.py file. For example if the version number in setup.py is 0.0.2 then do:
git tag 0.0.2 git push --tags
With thanks…
This extension has been built by Fjelltopp with funding from UNAIDS as part of the AIDS Data Repository project: https://adr.unaids.org
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ckanext-emailasusername-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948bb04db8afb80c91d7d201b36c0b20b3775ab874ad8a5556f4f743c0d6fbc3 |
|
MD5 | 2a588f25a304ce40985364e2c51bed1a |
|
BLAKE2b-256 | 09ce2435c26bc9023c8916ce91dbf085eb4a3b94404e74128a172b53d49e244a |
Hashes for ckanext_emailasusername-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 659ae70e31a5f9bdff3d9da34289b77d4995f0371c56637aa2b50fbb09c549a7 |
|
MD5 | 992fd431351740505c7f7c32a9b84be2 |
|
BLAKE2b-256 | 0172ac7b3289efcfaa198fe651b7ccade730d41a6b85560b39c2d81b117c730f |