hassio-addons / addon-bookstack

Bookstack - Home Assistant Community Add-ons
https://addons.community
MIT License
52 stars 12 forks source link

Forgot email and password, what to do? #283

Open RyansSohn opened 6 months ago

RyansSohn commented 6 months ago

Problem/Motivation

Hi, I forgot my email and my password. I did some research about how to change the admin password in bookstack, but there is no solution for bookstack as an add-on in homeassistant. There is an official post of bookstack, where they explain, that you can create a new admin account with a command, but you can't use this command in the homeassistant terminal. (https://www.bookstackapp.com/docs/admin/commands/) Can somebody help me? Maybe you just need to convert the command to use it in the homeassistant terminal, but I don't know how.

Maybe this helps? https://www.reddit.com/r/BookStack/comments/15au2ru/forgot_email_and_password/

(Why the issue was filed)

Expected behavior

you now the password and email

(What you expected to happen)

Actual behavior

you forgot password and email

(What actually happened)

Steps to reproduce

nothing

(How can someone else make/see it happen)

Proposed changes

(If you have a proposed change, workaround or fix, describe the rationale behind it)

pgorod commented 5 months ago

I have the same problem. This is a bit basic, I am sure there must be a way.

Any help appreciated - including instruction on how to wipe out bookstack and start fresh.

pgorod commented 5 months ago

Partially answering myself:

from HASS shell, you can get into the Bookstack add-on container:

List containers:

docker ps | grep bookstack

Grab the id from that list and use it in this next command:

docker exec -it 9515ff3014a0 bash

From inside that new shell, you can go ahead and

php artisan bookstack:create-admin --email="admin@admin.com" --name="Admin" --password="password"

That did not work for me, but I am not sure why, and maybe it's specific to my installation, so for you, at least it's worth a try...

Back outside the docker container, in the main HASS shell, you can also...

Enter the database:

mysql

And use SQL commands like

use bookstack; show tables; select user, password from users;

Passwords will be hashed, of course. You can also use an SQL UPDATE to add your own password, get the hash from here: https://bcrypt-generator.com/

bhofmann commented 5 months ago

same problem here, no chance to get it fixed, reinstalling bookstack didn't help. So thanks for that plugin but without a chance to easily set/reset users/passwords from within the config page in HA it is useless...

pgorod commented 5 months ago

@bhofmann are you aware that there is a default user name and password, did you try those?

I find it strange that you wrote that reinstalling bookstack didn't help...

bhofmann commented 5 months ago

Sure, I have tried this first and I expected that at least with deleting the add-on or integration and reinstall might fix this all, so I could start from scratch, but no, it seems that some things, maybe the mysql tables for book stack didn't get deleted and will be reused after a complete new install.

pgorod commented 5 months ago

Ah ok.

And did you try the solution going through docker that I posted above?

ArneSioen commented 3 months ago

Partially answering myself:

from HASS shell, you can get into the Bookstack add-on container:

List containers:

docker ps | grep bookstack

Grab the id from that list and use it in this next command:

docker exec -it 9515ff3014a0 bash

From inside that new shell, you can go ahead and

php artisan bookstack:create-admin --email="admin@admin.com" --name="Admin" --password="password"

That did not work for me, but I am not sure why, and maybe it's specific to my installation, so for you, at least it's worth a try...

Back outside the docker container, in the main HASS shell, you can also...

Enter the database:

mysql

And use SQL commands like

use bookstack; show tables; select user, password from users;

Passwords will be hashed, of course. You can also use an SQL UPDATE to add your own password, get the hash from here: https://bcrypt-generator.com/

Thank you! the sql edit worked for me!

illuzn commented 1 week ago

reinstalling bookstack didn't help

It will not help because bookstack uses the MariaDB database to store username/ password information. If you want to start from scratch you need to fully remove and reinstall MariaDB as well (beware if Maria DB is also your DB engine for Home Assistant).

illuzn commented 1 week ago

From inside that new shell, you can go ahead and

php artisan bookstack:create-admin --email="admin@admin.com" --name="Admin" --password="password"

That did not work for me, but I am not sure why, and maybe it's specific to my installation, so for you, at least it's worth a try...

This needs to be run from /var/www/bookstack which is where the artisan application is mapped to in this instance.