modified: scripts/set_mail_alias
modified: templates/myalias.html modified: views/inscription.py modified: views/profil.py
This commit is contained in:
parent
265e6d5f65
commit
dfebabe92d
@ -3,9 +3,9 @@
|
||||
BASE_URL="http://localhost:8000/" # si vous lancez pywallter avec flask run"
|
||||
|
||||
|
||||
BASE_URL="http://localhost:8000/"
|
||||
BASE_URL="https://profil.kitoy.me/"
|
||||
# Essentiels pour les cookies
|
||||
SECRET_KEY="CHANGE-ME"
|
||||
SECRET_KEY="Je te changerai mon ami"
|
||||
|
||||
# Dossier où seront stocker les fichiers
|
||||
DOSSIER_APP = "./users/"
|
||||
@ -19,7 +19,7 @@ EXT_IMG= {'.jpg', '.JPG', '.png', '.PNG', '.gif', '.GIF', '.bmp', '.BMP', '.jpeg
|
||||
# Service
|
||||
# XMPP = True => Le service est installé et lancer
|
||||
# XMMP = False => Le service est désactivé
|
||||
XMPP_SERVER = False
|
||||
XMPP_SERVER = True
|
||||
|
||||
# Service Mail
|
||||
# MAIL_SERVER = True => Le service est installé et lancer
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
. /etc/mailconfig
|
||||
|
||||
check_mail()
|
||||
check_domain()
|
||||
{
|
||||
mail=$1
|
||||
|
||||
domain=`echo $mail | awk -F '@' '{ print $2 }'`
|
||||
|
||||
if [ "$domain" != `hostname` ]; then
|
||||
@ -12,26 +13,20 @@ check_mail()
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
mail_exist=`egrep "$mail" $PASSWD_FILE`
|
||||
if [ -z $mail_exist ]; then
|
||||
print "This address doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
check_alias()
|
||||
{
|
||||
mail=$1
|
||||
alias=$1
|
||||
echo "$alias"
|
||||
alias_exist=`egrep "$alias" "$ALIAS_FILE"`
|
||||
|
||||
while read line; do
|
||||
alias=`echo $line | awk -F ':' '{ print $1 }'`
|
||||
isvmail=`echo $line | awk -F ':' '{ print $2 }'`
|
||||
if [ "$mail" = "$alias" ] && [ "$isvmail" != " vmail" ]; then
|
||||
echo "Address already exist in alias!"
|
||||
exit 2;
|
||||
fi;
|
||||
done < $ALIAS_FILE
|
||||
echo "$alias_exist"
|
||||
|
||||
if [ "$alias_exist" != "" ]; then
|
||||
echo "Address already exist in alias!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_app_mail()
|
||||
@ -51,14 +46,33 @@ add_alias()
|
||||
print "$2":" $1" >> "$ALIAS_FILE"
|
||||
}
|
||||
|
||||
check_mail_exist(){
|
||||
mail="$2"
|
||||
mail_exist=`egrep '"$mail"' $PASSWD_FILE`
|
||||
if [ "$mail_exist" != "" ]; then
|
||||
print "Address already exist"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_alias_exist(){
|
||||
|
||||
alias_c="$1: $2"
|
||||
|
||||
alias_exist=`egrep "$alias_c" "$ALIAS_FILE" `
|
||||
if [ -z "$alias_exist" ]; then
|
||||
print "This alias doesn't exist"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
del_alias()
|
||||
{
|
||||
while read line; do
|
||||
if [ "$1: $2" = "$line" ]; then
|
||||
cat "$ALIAS_FILE" | grep -w -v -e "$1" > /tmp/alias.tmp
|
||||
mv /tmp/alias.tmp "$ALIAS_FILE"
|
||||
fi
|
||||
done < "$ALIAS_FILE"
|
||||
alias_line="$1: $2"
|
||||
egrep -v "$alias_line" "$ALIAS_FILE" > /tmp/alias.tmp
|
||||
mv /tmp/alias.tmp "$ALIAS_FILE"
|
||||
}
|
||||
|
||||
|
||||
@ -89,17 +103,19 @@ then
|
||||
fi
|
||||
|
||||
|
||||
check_mail $1
|
||||
check_domain $1
|
||||
|
||||
|
||||
case $2 in
|
||||
"add")
|
||||
check_alias $3
|
||||
check_app_mail $3
|
||||
check_mail_exist $3
|
||||
check_alias $3
|
||||
check_app_mail $3
|
||||
add_alias $1 $3
|
||||
smtpctl update table virtuals
|
||||
;;
|
||||
"del")
|
||||
check_alias_exist $3 $1
|
||||
del_alias $3 $1
|
||||
smtpctl update table virtuals
|
||||
;;
|
||||
|
@ -1,13 +1,21 @@
|
||||
{% extends 'up_squelette.html' %}
|
||||
|
||||
|
||||
|
||||
{% block main %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
{% if MAIL_SERVER %}
|
||||
<div class="col-md-12">
|
||||
<table class="table">
|
||||
|
||||
<h3> A quoi ca sert les alias ? </h3>
|
||||
<p> Les alias c'est utile quand vous ne voulez pas donner votre vrai adresse e-mail.
|
||||
Vous pouvez creer une adresse que vous pouvez supprimer rapidemment, cela permet personnaliser une addrese pour un destinataire
|
||||
si vous n'avez pas confiance en lui ou de trier plus facilement les mails venant de ce destinataire.
|
||||
</p>
|
||||
<table class="table">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Mes Alias <span class="badge">{{ i }}</span></th>
|
||||
|
@ -60,7 +60,7 @@ def signin(token) :
|
||||
|
||||
|
||||
if MAIL_SERVER:
|
||||
mail = request.form['mail']+'@'+hostname
|
||||
mail = request.form['mail'].lower()+'@'+hostname
|
||||
if not(email_disp(mail)) :
|
||||
flash(u'Adresse email déjà utilisé ou invalide, merci d\'en choisir une autre', 'error')
|
||||
resp = render_template('inscription.html',
|
||||
|
@ -177,7 +177,7 @@ def myalias():
|
||||
cursor = conn.cursor() # Création de l'objet "curseur"
|
||||
if request.method == 'POST' and MAIL_SERVER:
|
||||
if request.form['alias']:
|
||||
alias = request.form['alias']+'@'+hostname
|
||||
alias = request.form['alias'].lower()+'@'+hostname
|
||||
else:
|
||||
flash(u'Addresse invalide')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user