From 28bbf772e8bac40dcd540a57501680726319f9fb Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Fri, 27 Dec 2024 08:07:12 -0500 Subject: [PATCH] Added URL --- .env | 1 + .env.dev | 1 + services/web/project/__init__.py | 31 ++++++++++++++++++++++++++----- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 3e1779d..db22bf7 100644 --- a/.env +++ b/.env @@ -1,6 +1,7 @@ FLASK_APP=project/__init__.py FLASK_DEBUG=1 SOCKET_URL=https://dev-socket.mermsemr.com +PANEL_URL=https://dev-panel.mermsemr.com DATABASE_URL=postgresql://merms_panel:merms_panel@10.20.30.60:5432/merms_panel SQL_HOST=10.20.30.60 SQL_PORT=5432 diff --git a/.env.dev b/.env.dev index 3e1779d..db22bf7 100644 --- a/.env.dev +++ b/.env.dev @@ -1,6 +1,7 @@ FLASK_APP=project/__init__.py FLASK_DEBUG=1 SOCKET_URL=https://dev-socket.mermsemr.com +PANEL_URL=https://dev-panel.mermsemr.com DATABASE_URL=postgresql://merms_panel:merms_panel@10.20.30.60:5432/merms_panel SQL_HOST=10.20.30.60 SQL_PORT=5432 diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index b30a196..bff4e2b 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -36,6 +36,7 @@ app.config.from_object("project.config.Config") db = SQLAlchemy(app) #jwt_secret = os.getenv("JWT_SECRET") app.config['SECRET_KEY'] = os.getenv("JWT_SECRET") +panel_url = os.getenv("PANEL_URL") mail = Mail(app) # instantiate the mail class @@ -103,6 +104,12 @@ engine = create_engine(dataUrl) @app.route("/") def hello_world(): +# mail.send( +# subject="Template example", +# receivers=["ameye@chiefsoft.com"], +# html_template="email/verify.html" +# ) + send_register_mail('ameye@chiefsoft.com') # msg = Message( # 'Hello', @@ -260,21 +267,35 @@ def start_register(): }, 500 def send_register_mail(signup_email): - msg = Message( +#panel_url + signup_data = {} + signup_data["id"] = '100' + signup_data["uid"] = 'a4b75649-e3c5-424f-bcdb-5481e625d24b' + + jwt_part = jwt.encode( + {"user": signup_data, 'exp' : datetime.datetime.utcnow() + datetime.timedelta(minutes=3330)}, + app.config["SECRET_KEY"], + algorithm="HS256" + ) + link_url= str(panel_url) + '/csignup/' + jwt_part + print(link_url) + msg = Message( 'verify your MERMS Account', sender ='message@chiefsoft.com', recipients = [signup_email,'ameye+merscopy@chiefsoft.com'] ) - msg.body = """Hello Firstname, - You recived this message for account verification + msg.body = """Hello Firstname, + You received this message for account verification - Follow the link: https://works.mermsemr.com/csignup/JWT-djhgdhjgdhdggggd + Follow the link:" {% link_url %} + + https://dev-panel.mermsemr.com/csignup/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiOTgyODkyODQyODI4NTI4OSIsInVpZCI6Ijk4Mjg5Mjg0MjgyODUyODkifSwiZXhwIjoxNzM1NTA0MDE4fQ.pDQvYUr_PGZMeMO2gr-B3DRQ7AM7IjVM5vSERNTviG4 For any Support Reach Out """ - mail.send(msg) + mail.send(msg) @app.route("/panel/auth/reset", methods=["POST"]) def start_resetpass():