Page 1 of 1

Lost webapp admin password

PostPosted: Thu Jun 02, 2016 11:21 am
by Arador
Is there a way to reset the webapp back to default without reloading the entire PI? I have SSH access to the system, I am just unable to login through the webapp page.

Re: Lost webapp admin password

PostPosted: Thu Jun 02, 2016 1:59 pm
by Arador
Nevermind, found a solution.

I had to wipe and reinstall the webapp from line 18.

Re: Lost webapp admin password

PostPosted: Thu Jun 02, 2016 2:29 pm
by kevin
In the "advanced " section, set up a system-wide email and you can use the forgot password feature going forward.

Re: Lost webapp admin password

PostPosted: Tue Aug 09, 2016 4:54 am
by bnorman
Arador wrote:Nevermind, found a solution.

I had to wipe and reinstall the webapp from line 18.


I have the same problem and would prefer to just change the password via terminal access if possible. What is the "line 18" you refer to? Thanks!

Re: Lost webapp admin password

PostPosted: Tue Aug 09, 2016 7:31 am
by kevin
If you haven't set a system-wide email configuration, you are unable to use the password recovery feature - you can preserve your settings if you are comfortable browsing and editing a sqlite database. http://sqlitebrowser.org/ - this tool will allow you to open and browse/edit the database. Turn off webapp via ssh - (sudo /etc/init.d/gunicorn stop) then download /opt/alarmdecoder-webapp/instance/db.sqlite and open with the downloaded db browser. Open up the user's table, and empty out the password field for the specified user. Re-upload the db.sqlite and restart gunicorn process. You should be able to login with a blank password and then reset your password.

If you aren't comfortable doing this, then you will have to remove the database and set up the webapp again.

Re: Lost webapp admin password

PostPosted: Wed Aug 10, 2016 4:24 am
by bnorman
Thanks, Kevin. I had set up email password recovery but recently changed ISPs and forgot to update the SMTP server info. I ended up doing the following from the shell to change the password.

#stop web app
sudo service gunicorn stop

#calculate the hash for the default password
python <<HERE
from werkzeug import generate_password_hash
print generate_password_hash('alarmdecoder')
HERE
# output: pbkdf2:sha1:1000$F8I2r5xL$ad225eb897418fadc943123a499ae6fdacbcce98

#update the password in the web app database (escaping dollar signs)
sqlite3 /opt/alarmdecoder-webapp/instance/db.sqlite <<HERE
update users set password='pbkdf2:sha1:1000\$F8I2r5xL\$ad225eb897418fadc943123a499ae6fdacbcce98' where name='admin';
HERE

#start web app
sudo service gunicorn start

Re: Lost webapp admin password

PostPosted: Wed Aug 10, 2016 7:20 am
by kevin
Great! Close to the same instructions I gave (except for the password hashing, great job figuring that one out :)) I just never really assume people are familiar with the linux command line so I try to give instructions that will work on a Windows Machine - but yes, perfect solution!

Re: Lost webapp admin password

PostPosted: Wed Aug 10, 2016 5:25 pm
by John
bnorman, thank you for your instructions!

You are a lifesaver.