Bug 2223926

Summary: Missing parameter in LoginForm in python3-flask-security-too
Product: [Fedora] Fedora Reporter: Jacek Pliszka <Jacek.Pliszka>
Component: python-flask-security-tooAssignee: Sandro Mani <manisandro>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: manisandro
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python-flask-security-too-4.1.5-3.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-07 01:28:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jacek Pliszka 2023-07-19 09:44:32 UTC
PGadmin fails with error in here:


/usr/lib/python3.11/site-packages/flask_security/forms.py

class LoginForm validate method is missing extra_validators parameter


Reproducible: Always

Steps to Reproduce:
1. run pgadmin4
2. on login form fails with error
3.
Actual Results:  
Fails with error

Expected Results:  
Login proceeds

newer version of flask-security has it fixed:

https://github.com/Flask-Middleware/flask-security/blob/bf5a31f86d132a927ed26caa59426f9389119516/flask_security/forms.py#L518C33-L518C33

Comment 1 Carl George 🤠 2023-08-29 02:17:24 UTC
The python3-flask component is for the EPEL7-only python3-flask package.  The file you mentioned is part of the python3-flask-security-too package in Fedora 38, which uses a component of python-flask-security-too.  I'm moving this bug over to that component.

Comment 2 Sandro Mani 2023-08-29 06:57:09 UTC
Can you please post the full stacktrace?

Comment 3 Jacek Pliszka 2023-08-29 07:37:02 UTC
2023-08-29 09:36:25,233: ERROR	pgadmin:	LoginForm.validate() got an unexpected keyword argument 'extra_validators'
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/pgadmin4/pgadmin/authenticate/__init__.py", line 118, in login
    if not auth_obj.validate():
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/pgadmin4/pgadmin/authenticate/__init__.py", line 245, in validate
    status, err_msg = source.validate(self.form)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/pgadmin4/pgadmin/authenticate/internal.py", line 104, in validate
    submit = form.validate_on_submit()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask_wtf/form.py", line 86, in validate_on_submit
    return self.is_submitted() and self.validate(extra_validators=extra_validators)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LoginForm.validate() got an unexpected keyword argument 'extra_validators'

Comment 4 Jacek Pliszka 2023-08-29 07:37:52 UTC
This is what fixes it:

$ diff /usr/lib/python3.11/site-packages/flask_security/forms.py .
443c443
<     def validate(self):
---
>     def validate(self, extra_validators=None):

Comment 5 Sandro Mani 2023-08-29 07:48:51 UTC
Looks like flask-wtf is incompatible with flask-security-too in F38

Comment 6 Jacek Pliszka 2023-08-29 08:19:01 UTC
You can add the simple patch or use higher version with the issue fixed.

Comment 7 Fedora Update System 2023-08-29 09:54:36 UTC
FEDORA-2023-2a2fc427ea has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-2a2fc427ea

Comment 8 Fedora Update System 2023-08-30 02:23:48 UTC
FEDORA-2023-2a2fc427ea has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-2a2fc427ea`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-2a2fc427ea

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Jacek Pliszka 2023-08-30 07:40:09 UTC
OK, just tested:

https://bodhi.fedoraproject.org/updates/FEDORA-2023-2a2fc427ea

dnf install  --enablerepo=updates-testing python3-flask-security-too

And now it works fine. Thank you.

Comment 10 Fedora Update System 2023-09-07 01:28:51 UTC
FEDORA-2023-2a2fc427ea has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.