config emsil param
This commit is contained in:
@@ -24,6 +24,9 @@ from app.config import Config
|
|||||||
class RegisterService(BaseService):
|
class RegisterService(BaseService):
|
||||||
JWT_SECRET_KEY = Config.JWT_SECRET_KEY
|
JWT_SECRET_KEY = Config.JWT_SECRET_KEY
|
||||||
|
|
||||||
|
SEND_EMAIL_FROM = Config.SEND_EMAIL_FROM
|
||||||
|
SEND_EMAIL_PASS = Config.SEND_EMAIL_PASS
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def process_verify(data):
|
def process_verify(data):
|
||||||
#"verify_link": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiMThmYzg0YTQtYjQzMC00ZWFkLWE4ZjEtMTk2MTJmNzA5ZDE0IiwiZXhwIjoxNzUyMjc2NjQzfQ.UEsSpCkMq8xNTLiqzyCB572tK-9WkeYaSBF4gfvX7vk"
|
#"verify_link": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiMThmYzg0YTQtYjQzMC00ZWFkLWE4ZjEtMTk2MTJmNzA5ZDE0IiwiZXhwIjoxNzUyMjc2NjQzfQ.UEsSpCkMq8xNTLiqzyCB572tK-9WkeYaSBF4gfvX7vk"
|
||||||
@@ -65,7 +68,7 @@ class RegisterService(BaseService):
|
|||||||
# "country": country,
|
# "country": country,
|
||||||
# }
|
# }
|
||||||
response_data = {
|
response_data = {
|
||||||
"member_id": data,
|
"user": data.user,
|
||||||
"country": country,
|
"country": country,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,17 +103,11 @@ class RegisterService(BaseService):
|
|||||||
email = validated_data.get('email')
|
email = validated_data.get('email')
|
||||||
|
|
||||||
regData = MembersPending.add_members_pending( firstname, lastname, email)
|
regData = MembersPending.add_members_pending( firstname, lastname, email)
|
||||||
# {
|
send_register_mail(regData.email, regData.uid, regData.id, firstname, lastname)
|
||||||
# "email": "ameye@chiefsoft.com",
|
|
||||||
# "firstname": "Olusesan",
|
|
||||||
# "lastname": "Ameye",
|
|
||||||
# "isChecked": true
|
|
||||||
# }
|
|
||||||
send_register_mail(regData.email, regData.uid, regData.id, firstname)
|
|
||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
"member_id": 0,
|
"pending_id": regData.id,
|
||||||
"uid": 0,
|
"pending_uid": regData.uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseHelper.success(data=response_data)
|
return ResponseHelper.success(data=response_data)
|
||||||
@@ -131,42 +128,15 @@ class RegisterService(BaseService):
|
|||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
return ResponseHelper.internal_server_error()
|
return ResponseHelper.internal_server_error()
|
||||||
|
|
||||||
# @staticmethod
|
|
||||||
# def check_loan_limits(customer_id):
|
|
||||||
# """
|
|
||||||
# Checks if a customer has exceeded the loan limits for given offer.
|
|
||||||
# """
|
|
||||||
# loan = Loan.get_customer_last_loan(customer_id)
|
|
||||||
#
|
|
||||||
# if not loan:
|
|
||||||
# return True
|
|
||||||
#
|
|
||||||
# offer_id = loan.offer_id[:5]
|
|
||||||
#
|
|
||||||
# offer = Offer.get_offer_by_id(offer_id)
|
|
||||||
# if not offer:
|
|
||||||
# logger.error(f"Offer not found for offer_id: {offer_id} (customer_id: {customer_id})")
|
|
||||||
# return False
|
|
||||||
#
|
|
||||||
# daily_count = Loan.get_daily_loan_count(customer_id, offer.product_id)
|
|
||||||
#
|
|
||||||
# logger.info(f"daily_count: {daily_count}, Max: {offer.max_daily_loans}")
|
|
||||||
#
|
|
||||||
# if offer.max_daily_loans is not None and daily_count >= offer.max_daily_loans:
|
|
||||||
# return False
|
|
||||||
#
|
|
||||||
# return True
|
|
||||||
|
|
||||||
|
def send_register_mail(signup_email, pending_uid,pending_id,firstname, lastname):
|
||||||
|
|
||||||
def send_register_mail(signup_email, email_uid,last_row_id,firstname):
|
|
||||||
|
|
||||||
pending_member = {
|
pending_member = {
|
||||||
"email": signup_email,
|
"email": signup_email,
|
||||||
"uid": email_uid,
|
"pending_uid": pending_uid,
|
||||||
"first_name": firstname,
|
"first_name": firstname,
|
||||||
"last_name": signup_email,
|
"last_name": lastname,
|
||||||
"member_id":last_row_id,
|
"pending_id":pending_id,
|
||||||
}
|
}
|
||||||
jwt_part = jwt.encode(
|
jwt_part = jwt.encode(
|
||||||
{"user": pending_member, 'exp' : datetime.datetime.utcnow() + datetime.timedelta(minutes=3330)},
|
{"user": pending_member, 'exp' : datetime.datetime.utcnow() + datetime.timedelta(minutes=3330)},
|
||||||
@@ -187,10 +157,10 @@ def send_register_mail(signup_email, email_uid,last_row_id,firstname):
|
|||||||
support@mermsemr.com
|
support@mermsemr.com
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sender_email = "support@wrenchboard.com"
|
sender_email = RegisterService.SEND_EMAIL_FROM
|
||||||
sender_password = 'May12002!xF7F220A97f' # Use an app-specific password if using Gmail
|
sender_password = RegisterService.SEND_EMAIL_PASS
|
||||||
receiver_email = signup_email
|
receiver_email = signup_email
|
||||||
subject = "verify your MERMS Account"
|
subject = "Verify your MERMS(AI) Account Setup"
|
||||||
body = msg_body
|
body = msg_body
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ class Config:
|
|||||||
BASIC_AUTH_USERNAME = os.environ.get("BASIC_AUTH_USERNAME", "user")
|
BASIC_AUTH_USERNAME = os.environ.get("BASIC_AUTH_USERNAME", "user")
|
||||||
BASIC_AUTH_PASSWORD = os.environ.get("BASIC_AUTH_PASSWORD", "password")
|
BASIC_AUTH_PASSWORD = os.environ.get("BASIC_AUTH_PASSWORD", "password")
|
||||||
|
|
||||||
|
#Email Server
|
||||||
|
SEND_EMAIL_FROM = os.environ.get("SEND_EMAIL_FROM","message@chiefsoft.com")
|
||||||
|
SEND_EMAIL_PASS = os.environ.get("SEND_EMAIL_PASS","may12002!")
|
||||||
|
|
||||||
# Database Configuration
|
# Database Configuration
|
||||||
DATABASE_USER = os.environ.get("DATABASE_USER","merms_panel")
|
DATABASE_USER = os.environ.get("DATABASE_USER","merms_panel")
|
||||||
|
|||||||
Reference in New Issue
Block a user