Login Issue

I have a webthings gateway installed on a Rasberry PI. I had been able to login using my hffidel/webthings.io link from my PC and my phone until about a month ago. Neither link now works. I get a blue image, with a + on the lower right. I I try to login directly by going to the PIs local IP address, I get a a screen asking for my login username and password. I use the email address and password that I have, but it doesn’t work. I can connect directly to the PI with a monitor and keyboard, but I don’t know what files to change to let me login. I can start over and do a new build, but short of that, what are my options? The webthings I have connected to the PI all work properly, but I can’t login to check for problems or battery life. I have seen some similar issues listed, but I either couldn’t understand the replies, or they didn’t work.
Thank you,
Howard

Hi @hffidel,

Welcome.

This is most likely due to a certificate renewal problem with the gateway. A fix is available for this issue, but we’re still working on pushing out an over-the-air update to gateways to fix it. Apologies for the inconvenience.

You should still be able to log in to your gateway whilst on your local network, using its local IP address or “gateway.local” domain. Do you think it’s possible that you’ve got the username or password wrong?

The gateway unfortunately doesn’t have a forgotten password feature because we don’t have an outgoing mail server it could safely use. Resetting your password without losing all of your devices and settings is therefore going to be tricky.

I don’t know if anyone has ever succeeded in manually editing the SQLite database to either set a new password or force the creation of a new user account?

Ben:
There is no rush here, so if you are working on a fix, that is good new, I can wait.

Thanks,
Howard

Hi ben, I was able to update my password in the database. It’s involved, but in case anyone is desperate here’s what to do. First you ssh in, and from the ~ directory, sqlite3 ~/.webthings/config/db.sqlite3 ‘SELECT * from users’ and you will see something like this:
1|hxxxx13@gmail.com|$2a$04$BD7b8R/C.M9tz1otq2IkSeuv2pbn3/cIkL2mUPp7OuzllAG.MemhW|Heather||0|[]
2|bxxxe@gmail.com|$2a$04$KwkTrBAYL6M3vPkpI2daC.kFPGus3l5UFP1Tyz9uxVvNADtL/2IFC|Bill||0|[]
This indicates there are two entries in the users, with ids 1 and 2. Now you can update the password with a new hash:
sqlite3 ~/.webthings/config/db.sqlite3 ‘update users set password = “$2a$04$KwkTrBAYL6M3vPkxI2daC.kFPGus3l5UFP1Tyz9uxVvNA” where id = 1’
This inserts a new hash in the password field for user 1 with e-mail hxxxx13@gmail.com. But how do you get the hash? First,
sudo apt-get install ts-node
Then
cd ~/webthings/gateway/src
cp passwords.ts dummy.ts
nano dummy.ts
Add a final line to the file,
hash(“newPassword”).then(str => console.log(str));
And ^O, enter then ^X
Then
ts-node dummy.ts
The output is your hash to use above. Now your password is reset to newPassword (but use something else).