flask-dashboard / Flask-MonitoringDashboard

Automatically monitor the evolving performance of Flask/Python web services.
http://flask-monitoringdashboard.readthedocs.io/
MIT License
780 stars 161 forks source link

Cannot login to dashboard #413

Open lambertaa opened 2 years ago

lambertaa commented 2 years ago

Describe the bug I cannot login to the monitoring dashboard with any username/password combination. I am not sure if I'm missing something. Do I need to have the monitoring dashboard database set up beforehand? Do I need to somehow establish users and passwords beforehand? I have set it up following the examples given in the documentation, as seen in the screenshots below.

I am deploying the API over mod_wsgi using mod_wsgi-express. From what I've seen, I don't think I should be expecting any bugs working with mod_wsgi-express.

To Reproduce Steps to reproduce the behavior:

  1. $ pip install flask_monitoringdashboard
  2. Import module and add configuration and bind lines to API file
  3. Launch API with mod_wsgi-express
  4. Visit /dashboard
  5. Attempt login using user/password: admin/admin

Expected behavior Using custom dashboard link, go to url and enter in username and password set in the dashboard.cfg file (admin/admin) to successfully access dashboard.

Screenshots image

Main API: image

Desktop (please complete the following information):

mircealungu commented 2 years ago

based on your configuration @lambertaa you should be able to login with guest/dashboardguest!

do you see any error messages in the console?

andreehultgren commented 2 years ago

@mircealungu I have the same bug, but without the config file. Just a generic:

app = Flask(__name__)
dashboard.bind(app)

But when I attempt to sign in to the dashboard, I get redirected back to the login page.

EDIT: Added logs:

Here are some logs from my login attempts

INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/ HTTP/1.1" 302 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/login HTTP/1.1" 200 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/static/css/app.css HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/static/img/header.png HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/static/js/app.js HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/static/fonts/fa-solid-900.woff2 HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/static/pages/overview.html HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:07] "GET   /dashboard/static/img/favicon.ico HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:13] "POST /dashboard/login HTTP/1.1" 200 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:13] "GET   /dashboard/static/css/app.css HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:13] "GET   /dashboard/static/img/header.png HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:13] "GET   /dashboard/static/js/app.js HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:13] "GET   /dashboard/static/pages/overview.html HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:17] "GET   /dashboard/static/css/app.css HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:23] "POST /dashboard/login HTTP/1.1" 200 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:23] "GET   /dashboard/static/css/app.css HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:23] "GET   /dashboard/static/img/header.png HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:23] "GET   /dashboard/static/js/app.js HTTP/1.1" 304 -
INFO 127.0.0.1 - - [11/Nov/2022 13:11:23] "GET   /dashboard/static/pages/overview.html HTTP/1.1" 304 -

Everything looks correct, there are no errors for the client or in the Flask server. The issue persists indepentend of browser (Chrome, Firefox and Edge). The overview HTML code is sent from the server, but is never rendered for the client.

alaferg commented 1 year ago

I had the same issue, but fixed it with the correct path to the config file, which is interpreted relative to the current folder (where your main.py lives). Note that it doesn't give you any error if it can't find the config file... So assuming your config file and your main.py file are both in tc_api_app, then you just need

dashboard.config.init_from(file='dashboard.cfg')
johnmarkschofield commented 1 year ago

I had this happen and I believe it was because there was incorrect data in the DB. It created the DB, and then I changed the blueprint and URL, and then I experienced identical symptoms. Deleting the DB resolved the issue.

AnubhavDubdub commented 1 year ago

Flask-monitoringDashboard uses Flask Sessions to authenticate. My issue got resolved once I added https://flask-session.readthedocs.io/en/latest/ in my app.

HrisyToteva commented 1 year ago

Hi @johnmarkschofield, @alaferg, @andreehultgren and @lambertaa thank you for bringing up this issue and taking the time to contribute to the Flask-MonitoringDashboard project.

As part of my school project, my team is conducting a usability research study to improve the dashboard. I noticed your experience with the app and thought it would be valuable to gather more insights from you.

Would you be open to receiving a few questions about your experience with Flask-MonitoringDashboard? It won't take more than 20 minutes to answer them. Your feedback will play a vital role in enhancing the app's functionality and addressing any existing limitations.

If you're interested, please let me know, and I will send you the questions. Your involvement would be highly valuable and greatly appreciated.