Skip to content

g.user.is_authenticated() error in app.py REQUIRE_WEBAPP_AUTH enabled #334

@justb4

Description

@justb4

Describe the bug
When web auth is required an error occurs when g.user.is_authenticated() . This comes from Flask-Login as the function is now an attribute g.user.is_authenticated

To Reproduce
Steps to reproduce the behavior, e.g.:

  1. Configure GHC with GQ_REQUIRE_WEBAPP_AUTH: True
  2. Go to app
  3. Expect login prompt
  4. Seeing Internal Server Error

Expected Behavior
Expect login prompt

Screenshots or Logfiles
Log shows:

  File "/GeoHealthCheck/GeoHealthCheck/app.py", line 112, in before_request
    g.user.is_authenticated(),  # This is from Flask-Login
TypeError: 'bool' object is not callable

Context (please complete the following information):

  • OS: any
  • Browser any
  • Browser Version any
  • Python Version 3.7
  • GeoHealthCheck Version 0.8.0 and later

If running with Docker:

  • GeoHealthCheck Docker Image version 0.8.0

Additional context
This was already an error when moving from Py2 to Py3. E.g. in all Jinja2 templates we had to change
g.user.is_authenticated() to g.user.is_authenticated as the function was changed to an attribute in Flask-Login.
Was introduced in 0.3.0: https://github.com/maxcountryman/flask-login/blob/master/CHANGES#L30
See also:
https://stackoverflow.com/questions/33062109/typeerror-bool-object-is-not-callable-g-user-is-authenticated

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions