Separate the email configuration into a new file

This commit is contained in:
Dita Aji Pratama 2025-05-30 14:02:01 +07:00
parent aebfc08edf
commit fc4839c682
3 changed files with 13 additions and 14 deletions

11
config/email.py Normal file
View File

@ -0,0 +1,11 @@
smtpconfig = {
"login" : {
"email" : "user@domain.com",
"password" : "your_password"
},
"server" : {
"host" : "smtp.domain.com",
"port" : 587
},
"from" : "user@domain.com"
}

View File

@ -22,18 +22,6 @@ reCAPTCHA = {
"server" : "your_key" "server" : "your_key"
} }
smtpconfig = {
"login" : {
"email" : "user@domain.com",
"password" : "your_password"
},
"server" : {
"host" : "smtp.domain.com",
"port" : 587
},
"from" : "user@domain.com"
}
verification_link_expiration = datetime.datetime.now() + datetime.timedelta(minutes=30) verification_link_expiration = datetime.datetime.now() + datetime.timedelta(minutes=30)
forgot_link_expiration = datetime.datetime.now() + datetime.timedelta(minutes=30) forgot_link_expiration = datetime.datetime.now() + datetime.timedelta(minutes=30)
# Can be hours or minutes # Can be hours or minutes

View File

@ -2,7 +2,7 @@ import mysql.connector as mariadb
from mako.template import Template from mako.template import Template
from bottle import request, response as bottle_response from bottle import request, response as bottle_response
from config import database, globalvar from config import database, email, globalvar
import bcrypt import bcrypt
import datetime import datetime
@ -17,7 +17,7 @@ class auth:
def __init__(self): def __init__(self):
self.db_main = mariadb.connect(**database.db_main) self.db_main = mariadb.connect(**database.db_main)
self.cursor = self.db_main.cursor(dictionary=True) self.cursor = self.db_main.cursor(dictionary=True)
self.smtpconfig = globalvar.smtpconfig self.smtpconfig = email.smtpconfig
def register(self, params): def register(self, params):
APIADDR = "/api/auth/register/:roles" APIADDR = "/api/auth/register/:roles"