#12330 Can't log into elections.fedoraproject.org
Closed: Fixed 3 months ago by vwbusguy. Opened 3 months ago by vwbusguy.

When attempting to vote or log into the elections site, I get this error:

400 - Bad Request

Invalid redirect_uri

FAS logins to other Fedora sites are working. It smells like an oauth client misconfiguration on the elections app side. The redirect_uri in the call goes to https://elections.fedoraproject.org/authorize with is CSRF protected.


Since the Ansible update for Flask-oidc, the login now works, but I get a 500 error when I actually try to vote when clicking the "Preview Your Vote" with the POST call on the /vote/f41%20fesco%20election endpoint.

Yeah, it's giving:

TypeError: Form.validate() got an unexpected keyword argument 'extra_validators'
2024-12-12 01:20:47,757 [ERROR] fedora_elections: Exception on /vote/f41 fesco election [POST]
Traceback (most recent call last):
  File "/opt/app-root/lib64/python3.11/site-packages/flask/app.py", line 1511, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app-root/lib64/python3.11/site-packages/flask/app.py", line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app-root/lib64/python3.11/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app-root/lib64/python3.11/site-packages/flask/app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app-root/src/fedora_elections/elections.py", line 54, in decorated_function
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/app-root/src/fedora_elections/elections.py", line 120, in vote
    return vote_range(election, revote)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app-root/src/fedora_elections/elections.py", line 177, in vote_range
    if form.validate_on_submit():
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app-root/lib64/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: Form.validate() got an unexpected keyword argument 'extra_validators'

CC: @zlopez @abompard

So, Elections has the version of wtforms pinned to 2.2.1, but the version of flask-wtf is not pinned and newer versions of it make use of a feature that appeared in wtforms 2.3.1.

I'll see if I can unpin wtforms, and if that doesn't work we'll have to pin flask-wtf as well.

Metadata Update from @zlopez:
- Issue assigned to abompard
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: medium-gain, medium-trouble, ops

3 months ago

This change worked for me in Firefox on Fedora 41 and Android 14. I was able to successfully vote and update my vote.

Metadata Update from @vwbusguy:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

3 months ago

Log in to comment on this ticket.

Metadata
Boards 1
ops Status: Backlog