fjelltopp / zarr-ckan

The Government of Zambia Ministry of Finance and National Planning project to establish a Zambia Evaluation and Research Repository (ZaRR) based on CKAN (funded by UNICEF).
0 stars 0 forks source link

Email addresses are case sensitive #196

Closed ChasNelson1990 closed 1 week ago

ChasNelson1990 commented 4 weeks ago

What happened?

If you try and log in with your email address - it fails if you use the wrong case. Does ckanext-emailasusername fix this?

Regression Test

Version

1.4.1 (current staging)

Relevant log output

No response

A-Souhei commented 3 weeks ago

@ChasNelson1990 ,

After verification, emailasusername is not fully compatible with zarr, neither the version 1.0.0 (in Pipfile) nor 1.2.1.

Retrieving a forgotten password and registering a new account are broken, and it does not fix the case sensitive email issue.

Shall I attempt to fix it?

A-Souhei commented 3 weeks ago

Stacktraces :

TypeError
TypeError: str cannot be used as validator because it is not a user-defined function

Traceback (most recent call last)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/lib/navl/dictization_functions.py", line 246, in convert
nargs = converter.__code__.co_argcount
During handling of the above exception, another exception occurred:
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask_debugtoolbar/__init__.py", line 157, in dispatch_request
return view_func(**req.view_args)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/views.py", line 84, in view
return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/views.py", line 158, in dispatch_request
return current_app.ensure_sync(meth)(*args, **kwargs)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/views/user.py", line 444, in post
user_dict = logic.get_action(u'user_create')(context, data_dict)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/logic/__init__.py", line 580, in wrapped
result = _action(context, data_dict, **kw)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/logic/action/create.py", line 1013, in user_create
data, errors = _validate(data_dict, schema, context)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/lib/navl/dictization_functions.py", line 305, in validate
flat_data, errors = _validate(flattened, schema, validators_context)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/lib/navl/dictization_functions.py", line 356, in _validate
convert(converter, key, converted_data, errors, context)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/lib/navl/dictization_functions.py", line 248, in convert
raise TypeError(
TypeError: str cannot be used as validator because it is not a user-defined function

TypeError
TypeError: 'User' object is not iterable

Traceback (most recent call last)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask_debugtoolbar/__init__.py", line 157, in dispatch_request
return view_func(**req.view_args)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckanext/emailasusername/blueprint.py", line 47, in request_reset
user_obj = user_by_username_or_email(id)
File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckanext/emailasusername/blueprint.py", line 26, in user_by_username_or_email
user_list = list(filter(not_deleted, user_list))
ChasNelson1990 commented 3 weeks ago

Is there a solution without the plugin? I.e. some sort of CKAN config to make user logins not care about case or something?

A-Souhei commented 1 week ago

After removing the >= Python 3.6 requirements directly from Pipfile.lock, it now works better but still with errors.

Traceback when registering a new account: Traceback (most recent call last) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2076, in wsgi_app response = self.handle_exception(e) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask_debugtoolbar/init.py", line 157, in dispatch_request return view_func(req.view_args) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/views.py", line 84, in view return current_app.ensure_sync(self.dispatch_request)(*args, *kwargs) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/views.py", line 158, in dispatch_request return current_app.ensure_sync(meth)(args, kwargs) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/views/user.py", line 444, in post user_dict = logic.get_action(u'user_create')(context, data_dict) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/logic/init.py", line 580, in wrapped result = _action(context, data_dict, *kw) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/logic/action/create.py", line 1013, in user_create data, errors = _validate(data_dict, schema, context) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/lib/navl/dictization_functions.py", line 305, in validate flat_data, errors = _validate(flattened, schema, validators_context)Open an interactive python shell in this frame File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/lib/navl/dictization_functions.py", line 356, in _validate convert(converter, key, converted_data, errors, context) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/ckan/lib/navl/dictization_functions.py", line 262, in convert value = converter(params) File "/usr/lib/ckan/ckanext-emailasusername/ckanext/emailasusername/plugin.py", line 100, in email_is_unique undeleted_users_matching_email = [ TypeError: 'NoneType' object is not iterable

When resetting password: Traceback (most recent call last) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2076, in wsgi_app response = self.handle_exception(e) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/ckan/.minikubevenv/ckan-ALitmJXH/lib/python3.8/site-packages/flask_debugtoolbar/init.py", line 157, in dispatch_request return view_func(**req.view_args) File "/usr/lib/ckan/ckanext-emailasusername/ckanext/emailasusername/blueprint.py", line 47, in request_reset user_obj = user_by_username_or_email(id) File "/usr/lib/ckan/ckanext-emailasusername/ckanext/emailasusername/blueprint.py", line 26, in user_by_username_or_email user_list = list(filter(not_deleted, user_list)) TypeError: 'User' object is not iterable

A-Souhei commented 1 week ago

Also, the ckanext-emailasusername authenticate() is not triggered when login in using the UI.