Be sure not to use blank passwords as the password

pull/107/head
dgtlmoon 4 years ago
parent a429223858
commit 45bd454e26

@ -483,7 +483,10 @@ def changedetection_app(config=None, datastore_o=None):
flash("Password protection enabled.", 'notice') flash("Password protection enabled.", 'notice')
flask_login.logout_user() flask_login.logout_user()
return redirect(url_for('index')) return redirect(url_for('index'))
else:
# Unset it anyway, just to be sure.
datastore.data['settings']['application']['password'] = False
flash("Settings updated.") flash("Settings updated.")
if request.method == 'POST' and not form.validate(): if request.method == 'POST' and not form.validate():

@ -46,11 +46,12 @@ class SaltyPasswordField(StringField):
# incoming # incoming
def process_formdata(self, valuelist): def process_formdata(self, valuelist):
if valuelist: if valuelist:
# Remove empty strings # Be really sure it's non-zero in length
self.encrypted_password = self.build_password(valuelist[0]) if len(valuelist[0].strip()) > 0:
self.data = [] self.encrypted_password = self.build_password(valuelist[0])
self.data = ""
else: else:
self.data = [] self.data = False
# Separated by key:value # Separated by key:value

Loading…
Cancel
Save