Lost webapp admin password

General Discussion

Lost webapp admin password

Postby Arador » Thu Jun 02, 2016 11:21 am

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.
Arador
newt
newt
 
Posts: 6
Joined: Sun Sep 14, 2014 4:02 pm

Re: Lost webapp admin password

Postby Arador » Thu Jun 02, 2016 1:59 pm

Nevermind, found a solution.

I had to wipe and reinstall the webapp from line 18.
Arador
newt
newt
 
Posts: 6
Joined: Sun Sep 14, 2014 4:02 pm

Re: Lost webapp admin password

Postby kevin » Thu Jun 02, 2016 2:29 pm

In the "advanced " section, set up a system-wide email and you can use the forgot password feature going forward.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Lost webapp admin password

Postby bnorman » Tue Aug 09, 2016 4:54 am

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!
bnorman
newt
newt
 
Posts: 2
Joined: Tue Jun 16, 2015 5:32 am

Re: Lost webapp admin password

Postby kevin » Tue Aug 09, 2016 7:31 am

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.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Lost webapp admin password

Postby bnorman » Wed Aug 10, 2016 4:24 am

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
bnorman
newt
newt
 
Posts: 2
Joined: Tue Jun 16, 2015 5:32 am

Re: Lost webapp admin password

Postby kevin » Wed Aug 10, 2016 7:20 am

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!
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Lost webapp admin password

Postby John » Wed Aug 10, 2016 5:25 pm

bnorman, thank you for your instructions!

You are a lifesaver.
John
newt
newt
 
Posts: 8
Joined: Tue Jul 19, 2016 8:04 pm


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests

cron