fix use of SetFELog with log_level="error" => level="danger"

This commit is contained in:
2024-01-21 18:17:45 +11:00
parent a3350b9316
commit 4db3d27cbc
3 changed files with 4 additions and 4 deletions

View File

@@ -142,7 +142,7 @@ def login():
# ldap-injecting our username, so send them back to the login page instead # ldap-injecting our username, so send them back to the login page instead
if request.method == 'POST' and re.search( r'[()\\*&!]', request.form['username']): if request.method == 'POST' and re.search( r'[()\\*&!]', request.form['username']):
from job import SetFELog from job import SetFELog
SetFELog( message=f"ERROR: Detected special LDAP chars in username: {request.form['username']}", log_level="error", persistent=True, cant_close=True ) SetFELog( message=f"ERROR: Detected special LDAP chars in username: {request.form['username']}", level="danger", persistent=True, cant_close=True )
return redirect(url_for('login')) return redirect(url_for('login'))
if form.validate_on_submit(): if form.validate_on_submit():
# Successfully logged in, We can now access the saved user object via form.user. # Successfully logged in, We can now access the saved user object via form.user.

View File

@@ -94,7 +94,7 @@ def AddRefimgToPerson( filename, person ):
except Exception as e: except Exception as e:
# can fail "silently" here, if the face_locn worked, great, its only # can fail "silently" here, if the face_locn worked, great, its only
# a tmp file in /tmp - if not, the next if will send a msg to the front-end # a tmp file in /tmp - if not, the next if will send a msg to the front-end
SetFELog( message=f"Failed to delete tmp file for refimg addition: {e}", log_level="danger", persistent=True, cant_close=True ) SetFELog( message=f"Failed to delete tmp file for refimg addition: {e}", level="danger", persistent=True, cant_close=True )
if not face_locn: if not face_locn:
SetFELog( f"<b>Failed to find face in Refimg:</b>", "danger" ) SetFELog( f"<b>Failed to find face in Refimg:</b>", "danger" )

View File

@@ -137,7 +137,7 @@ def SettingsRBPath():
settings = Settings.query.first() settings = Settings.query.first()
if settings == None: if settings == None:
from job import SetFELog from job import SetFELog
SetFELog( message="Cannot create file data with no settings / recycle bin path is missing", log_level="error", persistent=True, cant_close=False) SetFELog( message="Cannot create file data with no settings / recycle bin path is missing", level="danger", persistent=True, cant_close=False)
return return
# path setting is an absolute path, just use it, otherwise prepend base_path first # path setting is an absolute path, just use it, otherwise prepend base_path first
if settings.recycle_bin_path[0] == '/': if settings.recycle_bin_path[0] == '/':
@@ -155,7 +155,7 @@ def SettingsSPath():
settings = Settings.query.first() settings = Settings.query.first()
if settings == None: if settings == None:
from job import SetFELog from job import SetFELog
SetFELog( message="Cannot create file data with no settings / storage path is missing", log_level="error", persistent=True, cant_close=False) SetFELog( message="Cannot create file data with no settings / storage path is missing", level="danger", persistent=True, cant_close=False)
return return
if settings.storage_path[0] == '/': if settings.storage_path[0] == '/':
path=settings.storage_path path=settings.storage_path