Skip to content

Commit

Permalink
Add password change (#1003)
Browse files Browse the repository at this point in the history
* Update discover.py

* Update configHandler.py

* end wake up

* Update v2restapi.py

Add behavior instance to clip/v2/resource, to solve problem as in issue 873, now the app shows the automations

* wrong response

* add all buttons to response

* Update discover.py

Fix issue where lights with the same mac address but different modelid get the same ip address

* update wake-up

fix error "Exception while processing the schedule X | 'turn_lights_off_after'" if "turn_lights_off_after" is not specified

* fix add light in hue app

* Update requirements.txt

* Update requirements.txt

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update requirements.txt

* Update requirements.txt

* Update Dockerfile

* Update requirements.txt

* Update Dockerfile

* revert to old working

* Update Dockerfile

* Add identify request, non standard gateway, update version and api

* add easter egg

* Update Credits.py

* fixes, adds

fix typo and add update process

* Create updates_test.txt

* Delete updates_test.txt

* add version update

* Update Dockerfile

* Update restful.py

* Create update_test.txt

* Delete update_test.txt

* Create githubresponse.json

* Update githubresponse.json

* Update githubresponse.json

* Update updateManager.py

* Update updateManager.py

* add update

* Update updateManager.py

* Update githubInstall.sh

* Update updateManager.py

* combine code

* Update updateManager.py

* fix

* Update githubInstall.sh

* Update githubInstall.sh

* Update githubInstall.sh

* u

* Update githubInstall.sh

* Update scheduler.py

* Update updateManager.py

* Update githubInstall.sh

* Update login
  • Loading branch information
hendriksen-mark committed Mar 5, 2024
1 parent e72c095 commit a242d62
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 40 deletions.
5 changes: 3 additions & 2 deletions BridgeEmulator/flaskUI/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
bridgeConfig = configManager.bridgeConfig.yaml_config
core = Blueprint('core',__name__)
@core.route('/')
#@flask_login.login_required
@flask_login.login_required
def index():
return render_template('index.html', groups=bridgeConfig["groups"], lights=bridgeConfig["lights"])

Expand Down Expand Up @@ -103,7 +103,7 @@ def login():
flask_login.login_user(user)
return redirect(url_for('core.index'))

print(generate_password_hash(form.password.data))
logging.info("Hashed pass: " + generate_password_hash(form.password.data))

return 'Bad login'

Expand All @@ -119,6 +119,7 @@ def description_xml():


@core.route('/logout')
@flask_login.login_required
def logout():
flask_login.logout_user()
return redirect(url_for('core.login'))
19 changes: 13 additions & 6 deletions BridgeEmulator/flaskUI/restful.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from functions.rules import rulesProcessor
from services.entertainment import entertainmentService
from services.updateManager import githubCheck, versionCheck, githubInstall
from werkzeug.security import generate_password_hash

try:
from time import tzset
Expand Down Expand Up @@ -270,12 +271,18 @@ def put(self, username, resource):
else:
bridgeConfig[resource][key] = value

if resource == "config" and "swupdate2" in putDict:
if "checkforupdate" in putDict["swupdate2"] and putDict["swupdate2"]["checkforupdate"] == True:
versionCheck()
githubCheck()
if "install" in putDict["swupdate2"] and putDict["swupdate2"]["install"] == True:
githubInstall()
if resource == "config":
if "swupdate2" in putDict:
if "checkforupdate" in putDict["swupdate2"] and putDict["swupdate2"]["checkforupdate"] == True:
versionCheck()
githubCheck()
if "install" in putDict["swupdate2"] and putDict["swupdate2"]["install"] == True:
githubInstall()
if "users" in putDict:
for key, value in putDict["users"].items():
for email, hash in bridgeConfig["config"]["users"].items():
if putDict["users"][key] == bridgeConfig["config"]["users"][email]:
bridgeConfig["config"]["users"][email]["password"] = generate_password_hash(str(value['password']))

# build response list
responseList = []
Expand Down
2 changes: 1 addition & 1 deletion BridgeEmulator/flaskUI/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>DIYHUE LOGIN</h1>
</div>
</form>

<p>admin@diyhue.org / changeme</p>
<p>Standaard username: admin@diyhue.org / password: changeme, If lost check documentation</p>


</div>
Expand Down
50 changes: 19 additions & 31 deletions BridgeEmulator/githubInstall.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
curl -s localhost/save
cd /
[ ! -d diyhue ] && mkdir diyhue
curl -s -J -L -o $diyhue.tar.gz "https://github.com/diyhue/diyHue/archive/refs/heads/master.tar.gz"
tar xzf $diyhue.tar.gz --strip-components=1 -C diyhue
if [ ! -d diyhue ]; then
mkdir diyhue
fi
#curl -s -J -L -o diyhue.tar.gz "https://github.com/diyhue/diyHue/archive/refs/heads/master.tar.gz"
curl -s -J -L -o diyhue.tar.gz "https://github.com/hendriksen-mark/diyhue/archive/refs/heads/master.tar.gz"
tar xzf diyhue.tar.gz --strip-components=1 -C diyhue
#cd diyhue
[ -d /opt/hue-emulator/flaskUI ] && rm -r /opt/hue-emulator/flaskUI
mv diyhue/BridgeEmulator/flaskUI /opt/hue-emulator/

[ -d /opt/hue-emulator/functions ] && rm -r /opt/hue-emulator/functions
mv diyhue/BridgeEmulator/functions /opt/hue-emulator/

[ -d /opt/hue-emulator/lights ] && rm -r /opt/hue-emulator/lights
mv diyhue/BridgeEmulator/lights /opt/hue-emulator/

[ -d /opt/hue-emulator/sensors ] && rm -r /opt/hue-emulator/sensors
mv diyhue/BridgeEmulator/sensors /opt/hue-emulator/

[ -d /opt/hue-emulator/HueObjects ] && rm -r /opt/hue-emulator/HueObjects
mv diyhue/BridgeEmulator/HueObjects /opt/hue-emulator/

[ -d /opt/hue-emulator/services ] && rm -r /opt/hue-emulator/services
mv diyhue/BridgeEmulator/services /opt/hue-emulator

[ -d /opt/hue-emulator/configManager ] && rm -r /opt/hue-emulator/configManager
mv diyhue/BridgeEmulator/configManager /opt/hue-emulator/

[ -d /opt/hue-emulator/logManager ] && rm -r /opt/hue-emulator/logManager
mv diyhue/BridgeEmulator/logManager /opt/hue-emulator/

cp -r diyhue/BridgeEmulator/flaskUI/ /opt/hue-emulator/flaskUI/
cp -r diyhue/BridgeEmulator/functions/ /opt/hue-emulator/functions/
cp -r diyhue/BridgeEmulator/lights/ /opt/hue-emulator/lights/
cp -r diyhue/BridgeEmulator/sensors/ /opt/hue-emulator/sensors/
cp -r diyhue/BridgeEmulator/HueObjects/ /opt/hue-emulator/HueObjects/
cp -r diyhue/BridgeEmulator/services/ /opt/hue-emulatorservices/
cp -r diyhue/BridgeEmulator/configManager/ /opt/hue-emulator/configManager/
cp -r diyhue/BridgeEmulator/logManager/ /opt/hue-emulator/logManager/
mv diyhue/BridgeEmulator/HueEmulator3.py /opt/hue-emulator/
mv diyhue/BridgeEmulator/githubInstall.sh /opt/hue-emulator/
mv diyhue/BridgeEmulator/githubUIInstall.sh /opt/hue-emulator/
Expand All @@ -36,12 +23,13 @@ mv diyhue/BridgeEmulator/openssl.conf /opt/hue-emulator/
chmod +x /opt/hue-emulator/genCert.sh

#cd /
[ ! -d /diyhueUI ] && mkdir diyhueUI
if [ ! -d diyhueUI ]; then
mkdir diyhueUI
fi
curl -sL https://github.com/diyhue/diyHueUI/releases/latest/download/DiyHueUI-release.zip -o diyHueUI.zip
unzip -qo diyHueUI.zip -d diyhueUI
#cd diyhueUI
mv diyhueUI/index.html /opt/hue-emulator/flaskUI/templates/
[ -d /opt/hue-emulator/flaskUI/static ] && rm -r /opt/hue-emulator/flaskUI/static
mv diyhueUI/static /opt/hue-emulator/flaskUI/
cp -r diyhueUI/static/ /opt/hue-emulator/flaskUI/static/

curl -s "localhost.lan/reboot"
curl -s localhost/reboot

0 comments on commit a242d62

Please sign in to comment.