geosolutions-it/ckanext-azure-auth

Error when updating user

Opened this issue · 1 comments

etj commented

The user on the client gets a 500 HTTP code.

Server side we get this log:

ckan          | 2021-06-29 13:38:42,694 INFO  [repoze.who] request classification: browser
ckan          | 2021-06-29 13:38:42,694 INFO  [repoze.who] -- repoze.who request started (/user/edit/adfs-baeca10b-7cde-4142-bdee-b7b9bceccc60) --
ckan          | 2021-06-29 13:38:42,694 DEBUG [repoze.who] identifier plugins registered: [<FriendlyFormPlugin 140689142624208>, <CkanAuthTktCookiePlugin 140689142623144>]
ckan          | 2021-06-29 13:38:42,694 DEBUG [repoze.who] identifier plugins matched for classification "browser": [<FriendlyFormPlugin 140689142624208>, <CkanAuthTktCookiePlugin 140689142623144>]
ckan          | 2021-06-29 13:38:42,695 DEBUG [repoze.who] no identity returned from <FriendlyFormPlugin 140689142624208> (None)
ckan          | 2021-06-29 13:38:42,695 DEBUG [repoze.who] no identity returned from <CkanAuthTktCookiePlugin 140689142623144> (None)
ckan          | 2021-06-29 13:38:42,695 DEBUG [repoze.who] identities found: []
ckan          | 2021-06-29 13:38:42,695 INFO  [repoze.who] no identities found, not authenticating
ckan          | 2021-06-29 13:38:42,706 DEBUG [ckan.logic] check access OK - site_read user=adfs-baeca10b-7cde-4142-bdee-b7b9bceccc60
ckan          | 2021-06-29 13:38:42,710 DEBUG [ckan.logic] check access OK - user_update user=adfs-baeca10b-7cde-4142-bdee-b7b9bceccc60
ckan          | 2021-06-29 13:38:42,710 ERROR [ckan.config.middleware.flask_app] 'password1'
ckan          | Traceback (most recent call last):
ckan          |   File "/usr/lib/ckan/venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
ckan          |     rv = self.dispatch_request()
ckan          |   File "/usr/lib/ckan/venv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
ckan          |     return self.view_functions[rule.endpoint](**req.view_args)
ckan          |   File "/usr/lib/ckan/venv/lib/python3.7/site-packages/flask/views.py", line 89, in view
ckan          |     return self.dispatch_request(*args, **kwargs)
ckan          |   File "/usr/lib/ckan/venv/lib/python3.7/site-packages/flask/views.py", line 163, in dispatch_request
ckan          |     return meth(*args, **kwargs)
ckan          |   File "/usr/lib/ckan/venv/src/ckan/ckan/config/middleware/../../views/user.py", line 289, in post
ckan          |     if (data_dict[u'password1']
ckan          | KeyError: 'password1'
etj commented

The error is problably in this file:

https://github.com/geosolutions-it/ckanext-azure-auth/blob/main/ckanext/azure_auth/templates/user/edit_user_form.html

The original CKAN page always send password1 and password2, so in this page in case we're editing info for an ADFS user, such form fields should be hidden and always empty.