Flask-MonitoringDashboard icon indicating copy to clipboard operation
Flask-MonitoringDashboard copied to clipboard

Cannot login to dashboard

Open lambertaa opened this issue 2 years ago • 6 comments

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):

  • OS: Linux
  • Browser: edge/chrome
  • FMD Version: 3.1.1

lambertaa avatar Feb 22 '22 20:02 lambertaa

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

do you see any error messages in the console?

mircealungu avatar Mar 16 '22 11:03 mircealungu

@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.

andreehultgren avatar Nov 11 '22 11:11 andreehultgren

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')

alaferg avatar Jan 30 '23 21:01 alaferg

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.

johnmarkschofield avatar Feb 09 '23 02:02 johnmarkschofield

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

AnubhavDubdub avatar Jun 22 '23 10:06 AnubhavDubdub

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.

HrisyToteva avatar Jul 14 '23 08:07 HrisyToteva