From 58f587619eaaa85ced0149b7aabe2fb0ddedbfc0 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 4 Aug 2025 19:23:56 -0400 Subject: [PATCH] THIS_SITE_URL="https://qa-panel.mermsemr.com" --- .env | 2 ++ .env.live | 1 + .env.local.example | 1 + .env.qa | 1 + .example.env | 2 +- app/api/services/base_service.py | 4 ++-- app/api/services/login.py | 15 +++++++++------ app/api/services/register.py | 3 ++- app/config.py | 2 ++ 9 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 7338549..150ebbc 100644 --- a/.env +++ b/.env @@ -13,6 +13,8 @@ API_URL="/swagger.json" # VALID_API_KEY=************* # BASIC_AUTH_USERNAME=****** # BASIC_AUTH_PASSWORD=****** +#THIS_SITE_URL="http://localhost:8090" +THIS_SITE_URL="https://qa-panel.mermsemr.com" SWAGGER_URL="/documentation" API_URL="/swagger.json" diff --git a/.env.live b/.env.live index f82a879..2d90d8a 100644 --- a/.env.live +++ b/.env.live @@ -13,6 +13,7 @@ API_URL="/swagger.json" # VALID_API_KEY=************* # BASIC_AUTH_USERNAME=****** # BASIC_AUTH_PASSWORD=****** +THIS_SITE_URL="https://panel.mermsemr.com" SWAGGER_URL="/documentation" API_URL="/swagger.json" diff --git a/.env.local.example b/.env.local.example index aca0479..424c9bd 100644 --- a/.env.local.example +++ b/.env.local.example @@ -18,6 +18,7 @@ DATABASE_NAME=firstadvancedev # DATABASE_PASSWORD=firstadvance # DATABASE_NAME=firstadvancedev # DATABASE_PORT=5432 +THIS_SITE_URL="https://qa-panel.mermsemr.com" # Flask Configuration FLASK_APP=wsgi.py diff --git a/.env.qa b/.env.qa index dcc33e9..3d2d642 100644 --- a/.env.qa +++ b/.env.qa @@ -13,6 +13,7 @@ API_URL="/swagger.json" # VALID_API_KEY=************* # BASIC_AUTH_USERNAME=****** # BASIC_AUTH_PASSWORD=****** +THIS_SITE_URL="https://qa-panel.mermsemr.com" SWAGGER_URL="/documentation" API_URL="/swagger.json" diff --git a/.example.env b/.example.env index f71cb0b..af932e3 100644 --- a/.example.env +++ b/.example.env @@ -2,7 +2,7 @@ VALID_APP_ID=********** VALID_API_KEY=************* BASIC_AUTH_USERNAME=****** BASIC_AUTH_PASSWORD=****** - +THIS_SITE_URL="https://qa-panel.mermsemr.com" SWAGGER_URL="/documentation" API_URL="/swagger.json" diff --git a/app/api/services/base_service.py b/app/api/services/base_service.py index 9b15e85..6b8bae6 100644 --- a/app/api/services/base_service.py +++ b/app/api/services/base_service.py @@ -20,7 +20,7 @@ class BaseService: SEND_EMAIL_FROM = Config.SEND_EMAIL_FROM SEND_EMAIL_PASS = Config.SEND_EMAIL_PASS - + THIS_SITE_URL = Config.THIS_SITE_URL @staticmethod def send_resetpass_mail(signup_email, pending_uid, pending_id, firstname, lastname): @@ -39,7 +39,7 @@ class BaseService: {"user": pending_member, 'exp': datetime.datetime.utcnow() + datetime.timedelta(minutes=3330)}, BaseService.JWT_SECRET_KEY, algorithm='HS256' ) - panel_url = "https://qa-panel.mermsemr.com" + panel_url = BaseService.THIS_SITE_URL #"https://qa-panel.mermsemr.com" link_url = str(panel_url) + '/accreset/' + jwt_part msg_body = f""" diff --git a/app/api/services/login.py b/app/api/services/login.py index 91f2ff4..54879fd 100644 --- a/app/api/services/login.py +++ b/app/api/services/login.py @@ -16,7 +16,7 @@ from app.api.schemas.login import LoginSchema from app.api.schemas.reset_pass_start import ResetPassStart from app.api.schemas.reset_pass_verify import ResetPassVerify from app.api.schemas.reset_pass_complete import ResetPassComplete - +import json import datetime import jwt @@ -75,15 +75,15 @@ class LoginService(BaseService): validated_data = LoginService.validate_data(data, ResetPassVerify()) reset_token = validated_data.get('reset_token') - + logger.error("GOT HERE 000001 ") data ={} if not reset_token: return jsonify({'message': 'Error - missing reset_token '}), 403 try: data = jwt.decode(reset_token, LoginService.JWT_SECRET_KEY, algorithms=["HS256"]) except: - return jsonify({'status': 'INVALID', 'message': 'Link is invalid'}), 403 - + return jsonify({'status': 'INVALID2', 'message': 'Link is invalid'}), 403 + logger.error("GOT HERE 000002 ") if not data: invalid_data = { "error_message": "The link is invalid please try again later", @@ -92,10 +92,13 @@ class LoginService(BaseService): } return ResponseHelper.success(data=invalid_data) + user_data = data["user"] + + logger.error(f"GOT HERE 000003 {user_data}") response_data = { "error_message": "", - "pending_uid": data["pending_uid"], - "pending_id": data["pending_id"], + "pending_uid": user_data["pending_uid"], + "pending_id": user_data["pending_id"], "reset_message": "Check your email to continue password reset.", "message_key": "continue_reset", } diff --git a/app/api/services/register.py b/app/api/services/register.py index a9894db..b8584a1 100644 --- a/app/api/services/register.py +++ b/app/api/services/register.py @@ -30,6 +30,7 @@ class RegisterService(BaseService): SEND_EMAIL_FROM = Config.SEND_EMAIL_FROM SEND_EMAIL_PASS = Config.SEND_EMAIL_PASS + THIS_SITE_URL = Config.THIS_SITE_URL @staticmethod def encrypt_password(self, password): @@ -205,7 +206,7 @@ def send_register_mail(signup_email, pending_uid,pending_id,firstname, lastname) {"user": pending_member, 'exp' : datetime.datetime.utcnow() + datetime.timedelta(minutes=3330)}, RegisterService.JWT_SECRET_KEY, algorithm='HS256' ) - panel_url = "https://qa-panel.mermsemr.com" + panel_url = panel_url = RegisterService.THIS_SITE_URL # "https://qa-panel.mermsemr.com" link_url= str(panel_url) + '/csignup/' + jwt_part msg_body = f""" diff --git a/app/config.py b/app/config.py index c40e2fa..0523e61 100644 --- a/app/config.py +++ b/app/config.py @@ -12,6 +12,8 @@ class Config: BASIC_AUTH_USERNAME = os.environ.get("BASIC_AUTH_USERNAME", "user") BASIC_AUTH_PASSWORD = os.environ.get("BASIC_AUTH_PASSWORD", "password") + THIS_SITE_URL = os.getenv("THIS_SITE_URL", "https://qa-panel.mermsemr.com/") + #Email Server SEND_EMAIL_FROM = os.environ.get("SEND_EMAIL_FROM","message@chiefsoft.com") SEND_EMAIL_PASS = os.environ.get("SEND_EMAIL_PASS","may12002!")