Add function set_mail_hostname
This commit is contained in:
parent
481e179833
commit
e3100e77b2
@ -50,6 +50,12 @@ def valid_username(username):
|
|||||||
|
|
||||||
return valid
|
return valid
|
||||||
|
|
||||||
|
def set_mail_domain():
|
||||||
|
if MAIL_SERVER:
|
||||||
|
hostname = app.config['MAIL_DOMAIN']
|
||||||
|
else:
|
||||||
|
hostname = None
|
||||||
|
|
||||||
|
|
||||||
def email_disp(email):
|
def email_disp(email):
|
||||||
disp = True
|
disp = True
|
||||||
|
|||||||
@ -8,14 +8,13 @@ from tools.utils import email_disp, valid_token_register, valid_passwd, valid_us
|
|||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
import subprocess
|
import subprocess
|
||||||
from tools.filesutils import check_and_create
|
from tools.filesutils import check_and_create
|
||||||
|
from tools.utils import set_mail_domain
|
||||||
app = Flask( 'pywallter' )
|
app = Flask( 'pywallter' )
|
||||||
app.config.from_pyfile('config.py')
|
app.config.from_pyfile('config.py')
|
||||||
bcrypt = Bcrypt(app)
|
bcrypt = Bcrypt(app)
|
||||||
|
|
||||||
#### Variables ##################################################################################
|
#### Variables ##################################################################################
|
||||||
|
|
||||||
|
|
||||||
DATAS_USER = app.config['DOSSIER_APP']
|
DATAS_USER = app.config['DOSSIER_APP']
|
||||||
DOSSIER_PERSO = app.config['DOSSIER_APP']
|
DOSSIER_PERSO = app.config['DOSSIER_APP']
|
||||||
extensionimg = app.config['EXT_IMG']
|
extensionimg = app.config['EXT_IMG']
|
||||||
@ -24,7 +23,7 @@ MAIL_SERVER = app.config['MAIL_SERVER']
|
|||||||
XMPP_SERVER = app.config['XMPP_SERVER']
|
XMPP_SERVER = app.config['XMPP_SERVER']
|
||||||
SETUID = app.config['SETUID']
|
SETUID = app.config['SETUID']
|
||||||
BASE_URL = app.config['BASE_URL']
|
BASE_URL = app.config['BASE_URL']
|
||||||
MAIL_DOMAIN = app.config['MAIL_DOMAIN']
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +32,9 @@ inscription = Blueprint('inscription', __name__, template_folder='templates')
|
|||||||
|
|
||||||
@inscription.route( '/inscription/<token>', methods=['GET','POST'] )
|
@inscription.route( '/inscription/<token>', methods=['GET','POST'] )
|
||||||
def signin(token) :
|
def signin(token) :
|
||||||
hostname = MAIL_DOMAIN
|
|
||||||
|
mail_domain = set_mail_domain()
|
||||||
|
|
||||||
url_inscription = BASE_URL +'/inscription/'+token
|
url_inscription = BASE_URL +'/inscription/'+token
|
||||||
resp = None
|
resp = None
|
||||||
if valid_token_register(token, "Invitation"):
|
if valid_token_register(token, "Invitation"):
|
||||||
@ -44,7 +45,7 @@ def signin(token) :
|
|||||||
# Réponse si la requete est de type GET ou si la requete POST echoue
|
# Réponse si la requete est de type GET ou si la requete POST echoue
|
||||||
resp = render_template('inscription.html',
|
resp = render_template('inscription.html',
|
||||||
signin_enable=app.config['SIGNIN_ENABLE'],
|
signin_enable=app.config['SIGNIN_ENABLE'],
|
||||||
token=token, hostname=hostname,
|
token=token, hostname=mail_domain,
|
||||||
url_inscription=url_inscription,
|
url_inscription=url_inscription,
|
||||||
MAIL_SERVER=MAIL_SERVER, XMPP_SERVER=XMPP_SERVER)
|
MAIL_SERVER=MAIL_SERVER, XMPP_SERVER=XMPP_SERVER)
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import sqlite3
|
|||||||
import os
|
import os
|
||||||
from shutil import copy
|
from shutil import copy
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
from tools.utils import email_disp, append_to_log, gen_token, valid_passwd, login_required
|
from tools.utils import email_disp, append_to_log, gen_token, valid_passwd, login_required, set_mail_domain
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -28,11 +28,9 @@ MAIL_SERVER = app.config['MAIL_SERVER']
|
|||||||
XMPP_SERVER = app.config['XMPP_SERVER']
|
XMPP_SERVER = app.config['XMPP_SERVER']
|
||||||
SETUID = app.config['SETUID']
|
SETUID = app.config['SETUID']
|
||||||
BASE_URL = app.config['BASE_URL']
|
BASE_URL = app.config['BASE_URL']
|
||||||
MAIL_DOMAIN = app.config['MAIL_DOMAIN']
|
|
||||||
MAIL_WEBSERVICE = app.config['MAIL_WEBSERVICE']
|
MAIL_WEBSERVICE = app.config['MAIL_WEBSERVICE']
|
||||||
XMPP_WEBSERVICE = app.config['XMPP_WEBSERVICE']
|
XMPP_WEBSERVICE = app.config['XMPP_WEBSERVICE']
|
||||||
|
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ XMPP_WEBSERVICE = app.config['XMPP_WEBSERVICE']
|
|||||||
@login_required
|
@login_required
|
||||||
def mymessaging():
|
def mymessaging():
|
||||||
|
|
||||||
hostname=MAIL_DOMAIN
|
hostname=set_mail_domain()
|
||||||
user='%s' % escape(session['username'])
|
user='%s' % escape(session['username'])
|
||||||
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
||||||
cursor = conn.cursor() # Création de l'objet "curseur"
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
||||||
@ -67,7 +65,9 @@ def mymessaging():
|
|||||||
@mymailbox.route('/mymailbox/alias', methods=['GET', 'POST'] )
|
@mymailbox.route('/mymailbox/alias', methods=['GET', 'POST'] )
|
||||||
@login_required
|
@login_required
|
||||||
def myalias():
|
def myalias():
|
||||||
hostname=MAIL_DOMAIN
|
|
||||||
|
|
||||||
|
hostname = set_mail_domain()
|
||||||
user='%s' % escape(session['username'])
|
user='%s' % escape(session['username'])
|
||||||
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
||||||
cursor = conn.cursor() # Création de l'objet "curseur"
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user