Fix: User login and server console logging functionality.

This commit is contained in:
2024-10-29 17:18:39 +00:00
parent f6e0eb7a02
commit 8cbc3ea973
5 changed files with 14 additions and 8 deletions

1
app.py
View File

@@ -71,6 +71,7 @@ app = Flask(__name__)
# AppConfig(app)
app.config.from_object(app_config) # for db init with required keys
app.app_config = app_config
# app.config["config"] = app_config()
# logging

View File

@@ -20,6 +20,8 @@ load_dotenv(find_dotenv())
# CLASSES
class Config:
is_development = False
is_production = False
# Miscellaneous
DEBUG = False # av.input_bool(os.getenv('DEBUG'), 'DEBUG', 'Config')
TESTING = False
@@ -68,11 +70,13 @@ class Config:
RECAPTCHA_PRIVATE_KEY = os.getenv('RECAPTCHA_PRIVATE_KEY')
class DevelopmentConfig(Config):
is_development = True
DEBUG = True
MAIL_DEBUG = True
# Add development-specific configuration variables
class ProductionConfig(Config):
is_production = True
# Add production-specific configuration variables
pass

View File

@@ -36,5 +36,7 @@ class Helper_App(BaseModel):
@staticmethod
def console_log(message):
if current_app.config["DEBUG"]:
if current_app.app_config.is_development:
print(message)
elif current_app.app_config.is_production:
current_app.logger.info(message)

View File

@@ -92,13 +92,11 @@ BEGIN
IF ISNULL(a_id_user) THEN
INSERT INTO tmp_Msg_Error (
guid,
id_type,
code,
msg
)
VALUES (
v_guid,
v_id_type_error_bad_data,
v_code_error_bad_data,
CONCAT('User ID required for authorisation.')
@@ -479,9 +477,9 @@ END //
DELIMITER ;;
/*
CALL p_get_many_user (
CALL p_get_many_user (NULL, 'google-oauth2|109567376920138999933', False, False, False, NULL, 'google-oauth2|109567376920138999933', 0);
/*
NULL # a_id_user
, 'auth0|6582b95c895d09a70ba10fef' # a_id_user_auth0
, 0 # a_get_all_user
@@ -489,9 +487,10 @@ CALL p_get_many_user (
, 0 # a_get_first_user_only
, NULL # a_ids_user
, 'auth0|6582b95c895d09a70ba10fef' # a_ids_user_auth0
, 1 -- a_debug
);
, 0 -- a_debug
);*/
/*
select * FROM partsltd_prod.Shop_Calc_User_Temp;
delete FROM partsltd_prod.Shop_Calc_User_Temp;