Fixed mail sending
This commit is contained in:
parent
c310586fca
commit
7342516ce7
@ -6,8 +6,11 @@ from flasgger import Swagger
|
|||||||
from app.doc.main_swag import main_swagger
|
from app.doc.main_swag import main_swagger
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
jwt_manager = JWTManager(app)
|
from app.config import FlaskTesting, FlaskProduction
|
||||||
|
app.config.from_object(FlaskTesting)
|
||||||
|
|
||||||
mail = Mail(app)
|
mail = Mail(app)
|
||||||
|
jwt_manager = JWTManager(app)
|
||||||
swag = Swagger(app, template=main_swagger)
|
swag = Swagger(app, template=main_swagger)
|
||||||
|
|
||||||
def create_app():
|
def create_app():
|
||||||
@ -18,9 +21,6 @@ def create_app():
|
|||||||
app.register_blueprint(bp_user)
|
app.register_blueprint(bp_user)
|
||||||
app.register_blueprint(bp_cart)
|
app.register_blueprint(bp_cart)
|
||||||
|
|
||||||
from app.config import FlaskTesting, FlaskProduction
|
|
||||||
app.config.from_object(FlaskTesting)
|
|
||||||
|
|
||||||
from . import jwt_utils
|
from . import jwt_utils
|
||||||
|
|
||||||
return app
|
return app
|
@ -22,7 +22,8 @@ class FlaskTesting:
|
|||||||
SERVER_NAME = os.environ.get('HOST') + ':' + os.environ.get('PORT')
|
SERVER_NAME = os.environ.get('HOST') + ':' + os.environ.get('PORT')
|
||||||
|
|
||||||
MAIL_SERVER = os.environ.get('MAIL_SERVER')
|
MAIL_SERVER = os.environ.get('MAIL_SERVER')
|
||||||
MAIL_PORT = os.environ.get('MAIL_USERNAME')
|
MAIL_PORT = os.environ.get('MAIL_PORT')
|
||||||
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
|
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
|
||||||
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
|
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
|
||||||
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS')
|
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS')
|
||||||
|
MAIL_DEFAULT_SENDER = os.environ.get('MAIL_DEFAULT_SENDER')
|
@ -62,10 +62,7 @@ class UserService:
|
|||||||
print(f"Error: {e}")
|
print(f"Error: {e}")
|
||||||
return {"Failed": "Failed to insert into database. Username or email are likely in use already"}, 500
|
return {"Failed": "Failed to insert into database. Username or email are likely in use already"}, 500
|
||||||
|
|
||||||
# TODO Implement mail sending
|
send_mail("Successfully registered!", email, "Congratulations! Your account has been successfully created.\nThis mail also serves as a test that the email address is correct")
|
||||||
# Currently throws error - connection refused
|
|
||||||
|
|
||||||
# send_mail("Successfully registered!", email, "Congratulations! Your account has been successfully created.\nThis mail also serves as a test that the email address is correct")
|
|
||||||
|
|
||||||
return {"Success": "User created successfully"}, 200
|
return {"Success": "User created successfully"}, 200
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user