/scripts/alcasar-mail-install.sh |
---|
84,7 → 84,6 |
esac |
done |
fi |
echo "Type=$TYPE_MAIL - port=$port - smtpIP=$smtpIP - mailAddr=$mailAddr - mailMdp=$mailMdp - adminMail=$adminMail - whitedomain=$whiteDomain" |
if [[ $TYPE_MAIL -eq 0 ]]; then # disable mail service |
$SED "s/^MAIL=.*/MAIL=off/" $CONF_FILE |
$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=/" $CONF_FILE |
99,7 → 98,26 |
$SED "s/^\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT.*/#\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE |
$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = may/g" $POSTFIX_CONF_FILE |
$SED "/^smtp_tls_wrappermode = yes/d" $POSTFIX_CONF_FILE |
[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd |
elif [[ $TYPE_MAIL -eq 1 ]]; then # Enable mail service (act as smtp server) |
$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE |
$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=1/" $CONF_FILE |
$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=/" $CONF_FILE |
$SED "s/^MAIL_SMTP_PORT=.*/MAIL_SMTP_PORT=/" $CONF_FILE |
$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=/" $CONF_FILE |
$SED "s/^MAIL_PASSWORD=.*/MAIL_PASSWORD=/" $CONF_FILE |
$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAIN=$whiteDomain/" $CONF_FILE |
$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE |
$SED "/^SMTP_IP=/ s/^/#/" $LOCAL_IPTABLE_FILE |
$SED "/^SMTP_PORT=/ s/^/#/" $LOCAL_IPTABLE_FILE |
$SED "s/^\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT.*/#\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE |
$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = may/g" $POSTFIX_CONF_FILE |
$SED "/^smtp_tls_wrappermode = yes/d" $POSTFIX_CONF_FILE |
[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd |
elif [[ $TYPE_MAIL -eq 2 ]]; then # Enable mail service (relaying to an extern mail server) |
$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE |
$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=2/" $CONF_FILE |
113,7 → 131,9 |
$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$smtpPort/" $LOCAL_IPTABLE_FILE |
$SED "s/^#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^#\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT.*/\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^relayhost =.*/relayhost = $smtpIP:$port/g" $POSTFIX_CONF_FILE |
$SED "s/^relayhost =.*/relayhost = $smtpIP:$smtpPort/g" $POSTFIX_CONF_FILE |
$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = may/g" $POSTFIX_CONF_FILE |
$SED "/^smtp_tls_wrappermode = yes/d" $POSTFIX_CONF_FILE |
[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd |
elif [[ $TYPE_MAIL -eq 3 ]]; then # Enable mail service (using an email address) |
$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE |
128,9 → 148,11 |
$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$smtpPort/" $LOCAL_IPTABLE_FILE |
$SED "s/^#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^#\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT.*/\$IPTABLES -A INPUT -p tcp --sport \$SMTP_PORT -m conntrack --ctstate ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE |
$SED "s/^relayhost =.*/relayhost = $smtpIP:$port/g" $POSTFIX_CONF_FILE |
$SED "s/^relayhost =.*/relayhost = $smtpIP:$smtpPort/g" $POSTFIX_CONF_FILE |
$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = encrypt/g" $POSTFIX_CONF_FILE |
echo "smtp_tls_wrappermode = yes" >> $POSTFIX_CONF_FILE |
[ -d ${SASLPATH} ] || mkdir ${SASLPATH} |
echo "[${smtpIP}]:${port} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd |
echo "[${smtpIP}]:${smtpPort} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd |
postmap ${SASLPATH}/sasl_passwd |
chmod -R 644 ${SASLPATH} |
chown root:root ${SASLPATH}/sasl_passwd* |
/web/acc/manager/htdocs/user_by_email.php |
---|
29,7 → 29,7 |
$buffer = fgets($file_conf, 4096); |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) { |
$tmp = explode('=', $buffer, 2); |
$mail_conf[trim($tmp[0])] = trim($tmp[1]); |
$conf[trim($tmp[0])] = trim($tmp[1]); |
} |
} |
fclose($file_conf); |
60,6 → 60,25 |
$l_mail_YES = "OUI"; |
$l_mail_NO = "NON"; |
$l_mail_submit = "Enregistrer"; |
} else if($Language == 'es') { |
$l_mail_title = "Registro por email"; |
$l_mail_registration = "Activar el registro por correo electrónico :"; |
$l_mail_choice = "Qué tipo de servicio de correo utiliza?"; |
$l_use_internal_server = "Utilizar el servidor de correo interno"; |
$l_use_external_server = "Retransmisión a un servidor de correo externo"; |
$l_use_email_address = "Utilizar una dirección de correo electrónico"; |
$l_email_address = "Dirección de correo electrónico utilizada para el envío de correo"; |
$l_email_password = "Contraseña"; |
$l_email_password_confirm = "Confirmar contraseña"; |
$l_mail_service = "Elija el servicio de correo"; |
$l_mail_smtp_ip = "Dirección IP o nombre del servidor de correo"; |
$l_mail_smtp_port = "Puerto de escucha del servidor de correo"; |
$l_admin_log = "Advertencia del administrador"; |
$l_mail_admin = "Dirección de correo electrónico del administrador"; |
$l_whitelist_domain = "Nombres de dominio autorizados (lista blanca)"; |
$l_mail_YES = "SI"; |
$l_mail_NO = "NO"; |
$l_mail_submit = "SI"; |
} else { |
$l_mail_title = "Registration by Email"; |
$l_mail_registration = "Enable registration by Email :"; |
82,15 → 101,15 |
} |
// Mail configuration params |
$mail_status = $mail_conf['MAIL']; |
$mail_type = $mail_conf['MAIL_TYPE']; |
$mail_address = $mail_conf['MAIL_ADDR']; |
$mail_smtp_port = $mail_conf['MAIL_SMTP_PORT']; |
$mail_smtp_ip = $mail_conf['MAIL_SMTP_IP']; |
$mail_status = $conf['MAIL']; |
$mail_type = $conf['MAIL_TYPE']; |
$mail_address = $conf['MAIL_ADDR']; |
$mail_smtp_ip = $conf['MAIL_SMTP_IP']; |
$mail_smtp_port = $conf['MAIL_SMTP_PORT']; |
$mail_password_mail = ""; |
$mail_password_mail_2 = ""; |
$mail_admin = $mail_conf['MAIL_ADMIN']; |
$mail_whitelist = $mail_conf['MAIL_WHITEDOMAIN']; |
$mail_admin = $conf['MAIL_ADMIN']; |
$mail_whitelist = $conf['MAIL_WHITEDOMAIN']; |
if(isset($_POST['submit'])){ |
if($_POST['mail_enable'] === 'on') |
101,12 → 120,12 |
if(isset($_POST['mail_address'])) { $mail_address = $_POST['mail_address']; } |
if(isset($_POST['mail_server'])) { $mail_server = $_POST['mail_server']; } |
if(isset($_POST['mail_smtp_ip'])) { $mail_smtp_ip = $_POST['mail_smtp_ip']; } |
if(isset($_POST['mail_smtp_port'])) { $mail_smtp_ip = $_POST['mail_smtp_port']; } |
if(isset($_POST['mail_smtp_port'])) { $mail_smtp_port = $_POST['mail_smtp_port']; } |
if(isset($_POST['mail_mdp'])) { $mail_mdp = $_POST['mail_mdp']; } |
if(isset($_POST['mail_mdp2'])) { $mail_mdp2 = $_POST['mail_mdp2']; } |
if ($admin_enable == "1") { $mail_admin = $_POST['mail_admin']; } |
switch ($mail_type) { |
case '1': |
case '1': // Act as a SMTP server |
$mail_smtp_port = 25; |
if ($admin_enable == "1"){ |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -a $mail_admin -w $mail_whitelist"); |
115,7 → 134,7 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist"); |
} |
break; |
case '2': |
case '2': // Relay to an external SMTP server |
if ($admin_enable == "1"){ |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_smtp_port -a $mail_admin -w $mail_whitelist"); |
} |
123,7 → 142,7 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp_ip -p $mail_smtp_port -w $mail_whitelist"); |
} |
break; |
case '3': |
case '3': // Use an user Email address |
if(($mail_mdp != '') && ($mail_mdp==$mail_mdp2)) { |
switch ($mail_server) { |
case '1': |
192,22 → 211,13 |
<meta charset="UTF-8"> |
<title><?= $l_mail_title ?></title> |
<link type="text/css" href="/css/acc.css" rel="stylesheet"> |
<link type="text/css" href="/css/mail.css" rel="stylesheet"> |
<script> |
function onMailStatusChange() { |
var listToDisables1 = ['mail_type','admin_enable','mail_admin','mail_whitelist']; |
var listToDisables2 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip']; |
var listToDisables3 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip','mail_mdp2','mail_mdp','mail_address']; |
var listToDisables2 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip','mail_smtp_port']; |
var listToDisables3 = ['mail_type','admin_enable','mail_admin','mail_whitelist','mail_server','mail_smtp_ip','mail_smtp_port','mail_address','mail_mdp','mail_mdp2']; |
var formSubmit = document.querySelector('form input[type="submit"]'); |
var isChecked = false; |
for (var i=0; i<listToDisables1.length; i++) { |
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0'; |
document.getElementById(listToDisables1[i]).disabled = true; |
} |
for (var i=0; i<listToDisables2.length; i++) { |
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0'; |
document.getElementById(listToDisables2[i]).disabled = true; |
} |
for (var i=0; i<listToDisables3.length; i++) { |
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0'; |
document.getElementById(listToDisables3[i]).disabled = true; |
237,6 → 247,8 |
if (document.getElementById('mail_server').value != '9') { |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0'; |
document.getElementById('mail_smtp_ip').disabled = true; |
document.getElementById('mail_smtp_port').style.backgroundColor = '#c0c0c0'; |
document.getElementById('mail_smtp_port').disabled = true; |
} |
} |
else if (document.getElementById('mail_type').value === '3') { |
251,6 → 263,8 |
if (document.getElementById('mail_server').value != '9') { |
document.getElementById('mail_smtp_ip').style.backgroundColor = '#c0c0c0'; |
document.getElementById('mail_smtp_ip').disabled = true; |
document.getElementById('mail_smtp_port').style.backgroundColor = '#c0c0c0'; |
document.getElementById('mail_smtp_port').disabled = true; |
} |
} |
formSubmit.style.display = null; |
286,7 → 300,7 |
</dt> |
<dd> |
<select id="mail_type" name="mail_type" onchange="onMailStatusChange();"> |
<!--<option value="1"<?= ($mail_type == '1') ? ' selected="selected"' : '' ?>><?= $l_use_internal_server ?></option>--> |
<option value="1"<?= ($mail_type == '1') ? ' selected="selected"' : '' ?>><?= $l_use_internal_server ?></option> |
<option value="2"<?= ($mail_type == '2') ? ' selected="selected"' : '' ?>><?= $l_use_external_server ?></option> |
<option value="3"<?= ($mail_type == '3') ? ' selected="selected"' : '' ?>><?= $l_use_email_address ?></option> |
</select> |
305,7 → 319,7 |
<label for="mail_mdp"><?= $l_email_password ?></label><br> |
</dt> |
<dd> |
<input type="text" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();"> |
<input type="password" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();"> |
</dd> |
</dl> |
<dl> |
313,7 → 327,7 |
<label for="mail_mdp2"><?= $l_email_password_confirm ?></label><br> |
</dt> |
<dd> |
<input type="text" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();"> |
<input type="password" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();"> |
</dd> |
</dl> |
<dl> |
/web/email_registration_back.php |
---|
3,7 → 3,8 |
/************************************************************************ |
* ALCASAR INSCRIPTION * |
* * |
* By K@M3L & T3RRY LaPlateforme * |
* By K@M3L & T3RRY LaPlateforme |
* By Rexy * |
* * |
* Partie back de la page d'inscription des utilisateurs * |
* Récupère les infos de "email_registration_front.php * |
16,6 → 17,43 |
* * |
*************************************************************************/ |
/**************************************************************** |
* GLOBAL FILE PATHS * |
*****************************************************************/ |
define('CONF_FILE', '/usr/local/etc/alcasar.conf'); |
/**************************************************************** |
* Conf files reading test * |
*****************************************************************/ |
$conf_files = array(CONF_FILE); |
foreach ($conf_files as $file) { |
if (!file_exists($file)) { |
exit("Fichier $file non présent"); |
} |
if (!is_readable($file)) { |
exit("Vous n'avez pas les droits de lecture sur le fichier $file"); |
} |
} |
/**************************************************************** |
* Read CONF_FILE * |
*****************************************************************/ |
$file_conf = fopen(CONF_FILE, 'r'); |
if (!$file_conf) { |
exit('Error opening the file '.CONF_FILE); |
} |
while (!feof($file_conf)) { |
$buffer = fgets($file_conf, 4096); |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) { |
$tmp = explode('=', $buffer, 2); |
$conf[trim($tmp[0])] = trim($tmp[1]); |
} |
} |
fclose($file_conf); |
$whiteDomain = explode(" ", strtolower(trim($conf['MAIL_WHITEDOMAIN']))); |
$adminMail = $conf['MAIL_ADMIN']; |
/**************************************** |
* Choice of language * |
*****************************************/ |
$Language = 'en'; |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); |
26,11 → 64,27 |
$l_domain = "Le domaine"; |
$l_not_authorized = "n'est pas autorisé"; |
$l_Email_already_used = "Cette adresse email est déjà utilisée."; |
$l_subject = "Activation de votre compte ALCASAR"; |
$l_hello = "Bonjour"; |
$l_automatic_mail = "Ceci est un e-mail automatique provenant d'un portail ALCASAR"; |
$l_login = "Vos indentifiants de connexion :"; |
$l_email = "Adresse e-mail"; |
$l_password = "Mot de passe"; |
$l_go_home = "Rendez-vous sur la page d'accueil"; |
$l_mail_error = "Erreur lors de l'envoi du mail. Renouvelez votre inscription ou contactez votre administrateur."; |
} else { |
$l_invalid_Email = "Invalid Email address"; |
$l_domain = "The domain"; |
$l_not_authorized = "is not authorized"; |
$l_Email_already_used = "This Email address is already used."; |
$l_subject = "Activation of your ALCASAR account"; |
$l_hello = "Hello"; |
$l_automatic_mail = "This is an automatic e-mail from an ALCASAR portal"; |
$l_login = "Your login credentials :"; |
$l_email = "e-mail address"; |
$l_password = "Password"; |
$l_go_home = "Go to the home page"; |
$l_mail_error = "Error while sending the email. Renew your registration or contact your administrator."; |
} |
if (is_file("acc/manager/lib/langues.php")) |
91,40 → 145,18 |
return $password; |
} |
// Lecture du fichier de configuration, récupération des listes WLD et l'email de l'admin |
$alcasar_Conf_File = "/usr/local/etc/alcasar.conf"; |
if (is_file ($alcasar_Conf_File)){ |
$tab=file($alcasar_Conf_File); |
if ($tab){ |
foreach ($tab as $line){ |
$field=explode("=", $line); |
switch ($field[0]){ |
case 'MAIL_WHITEDOMAIN': |
$whiteDomain = explode(" ", strtolower(trim($field[1]))); |
break; |
case 'MAIL_ADMIN': |
$adminMail = $field[1]; |
break; |
} |
} |
} |
} |
if(isset($_POST['Fmail'])){ |
extract($_POST); |
$Fmail = htmlentities(strtolower(trim($Fmail))); |
if(!filter_var($Fmail, FILTER_VALIDATE_EMAIL)){ |
echo "<b>$l_invalid_Email</b><br />\n"; |
exit(); |
} |
// on récupère le nom de domaine du mail@domain.com |
// Retrieve the domainName of the new user |
list($user, $domain) = explode('@', $Fmail); |
// on vérifie si le domaine est dans la WLD, sinon on bloque |
// check if the domainName is in the whitelist |
if (!empty($whiteDomain)){ |
if (!in_array($domain, $whiteDomain)){ |
echo "$l_domain $domain $l_not_authorized"; |
131,40 → 163,33 |
exit(); |
} |
} |
$login = $Fmail; |
// si le login est présent |
// check if the new user already exist |
$link = @da_sql_pconnect($config); |
if ($link) { |
$sql = "SELECT id FROM $config[sql_check_table] WHERE username = '$login';"; |
$res = @da_sql_query($link,$config, $sql); |
} |
$login_check = da_sql_num_rows($res,$config); |
da_sql_close($link,$config); |
$login_check = da_sql_num_rows($res,$config); |
// da_sql_close($link,$config) |
// si le mail est présent |
// check if the new user is already in the profile of an existing user |
$link = @da_sql_pconnect($config); |
if ($link) { |
$sql = "SELECT id FROM $config[sql_user_info_table] WHERE mail = '$Fmail';"; |
$res = @da_sql_query($link,$config, $sql); |
} |
$email_check = da_sql_num_rows($res,$config); |
// da_sql_close($link,$config) |
if($login_check > 0) { //Adresse email utilisée en tant que login |
$email_check = da_sql_num_rows($res,$config); |
da_sql_close($link,$config); |
if($login_check > 0) { // user already exist |
echo "<b>$l_Email_already_used</b><br />\n"; |
} else if($email_check > 0) { //Adresse email utilisée dans les infos utilisateur |
} else if($email_check > 0) { // email already used |
echo "<b>$l_Email_already_used</b><br />\n"; |
} else { |
$password = GenPassword(); |
// si on ajoute des inputs pour les infos user |
// if we want to enrich the new user profile |
/* $Fcn = "$prenom".".$nom"; |
$Fou = ""; |
$Fhomephone = ""; |
208,12 → 233,12 |
echo "<b>Une erreur s'est produite lors de la création du compte : " . da_sql_error($link,$config) . "</b><br />\n"; |
} |
else |
echo "<b>L'utilisateur existe déjà</b><br />\n"; |
echo "<b>User already exist</b><br />\n"; |
} |
else |
echo "<b>Une erreur s'est produite lors de la création du compte : " . da_sql_error($link,$config) . "</b><br />\n"; |
} |
// si on veut ajouter les nouveau utilisateurs a un groupe par défaut, autre que celui par défaut d'alcasar |
// if the new user must be in a group |
if (isset($Fgroup) && $Fgroup != ''){ |
$Fgroup = da_sql_escape_string($link, $Fgroup); |
$res = da_sql_query($link,$config, |
233,6 → 258,7 |
else |
echo "<b>Impossible d'ajouter l'utilisateur dans le groupe $Fgroup: " . da_sql_error($link,$config) . "</b><br />\n"; |
} |
/* |
if (!$da_abort){ |
if (isset($Fgroup) && $Fgroup != '') |
require('acc/manager/lib/defaults.php'); |
276,16 → 302,15 |
echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br />\n"; |
} |
} |
// L'utilisateur est ajouter dans la radcheck, ses info dans la userinfo, on envoi le mail avec identifiant et passwd |
*/ |
// Creation of the email with the new user login & passwd |
$ip = $_SERVER['REMOTE_ADDR']; |
$time = date_create('now')->format('d-m-Y H:i:s'); |
$domain = $conf["DOMAIN"]; |
$hostname = $conf["HOSTNAME"].'.'.$domain; |
$hostname = $conf["HOSTNAME"]; |
$to = $Fmail; |
$from = "alcasar@$domain"; |
$subject = "Activation de votre compte ALCASAR"; |
$from = "administrator"; |
$subject = $l_subject; |
$message = "<!DOCTYPE html> |
<html> |
<head> |
292,33 → 317,28 |
<meta charset=\"UTF-8\" /> |
</head> |
<body> |
Bonjour,<br/><br/> |
<h3>Bienvenue sur ALCASAR @ $domain</h3> |
<p>Ceci est un email automatique avec vos identifiants, veuillez changer votre mot de passe.<br/> |
<h4>Indentifiants de connexion:</h4> |
<pre> |
Adresse e-mail : $Fmail |
Login : $login |
Mot de passe : $password |
</pre> |
<p>Rendez-vous sur le portail <a href=\"https://$hostname\">$domain</a></p> |
$l_hello,<br/><br/> |
<p>$l_automatic_mail ($hostname.$domain)<br/> |
<h4>$l_login</h4> |
<pre> |
$l_email : $Fmail |
Login : $login |
$l_password : $password |
</pre> |
<p>$l_go_home : <a href=\"https://$hostname.$domain\"></a></p> |
</body> |
</html>"; |
$header = "From: $from\n"; |
$header .= "MIME-Version: 1.0\n"; |
$header .= "Content-type: text/html; charset=utf-8\n"; |
if(mail($to, $subject, $message, $header)){ |
echo "<center>success : <b>Vous y êtes presque ! $l_user '$login' $l_created</b></center><br />"; |
echo "<center>success : <b>Un email contenant vos informations de connexion vient de vous être envoyé.</b></center><br />"; |
// le mail pour l'uitilisateur est envoyé, si l'admin a configuré son mail, on lui envoi |
// une notification d'inscription avec l'ip, l'heure, et le login de l'utilisateur |
// Creation of the email for the administrator (if enabled) |
if (!empty($adminMail)){ |
$to = $adminMail; |
$from = "alcasar@$domain"; |
$subject = "Nouvelle inscription sur ALCASAR"; |
$from = "administrator"; |
$subject = "New registration on ALCASAR"; |
$message = "<!DOCTYPE html> |
<html> |
<head> |
325,19 → 345,16 |
<meta charset=\"UTF-8\" /> |
</head> |
<body> |
Bonjour,<br/><br/> |
<p>Ceci est un mail automatique.<br/> |
<h3>Une nouvelle inscription à <strong>ALCASR $domain</strong> a été faite.</h3> |
<h4>Indentifiants de connexion:</h4> |
<pre> |
Adresse IP : $ip |
Heure : $time; |
Login : $login |
Email : $Fmail |
</pre> |
<p>ALCASAR <a href=\"https://$hostname\">$domain</a></p> |
Hello,<br/><br/> |
<p>This is an automatic e-mail from an ALCASAR portal.<br/> |
<h3>A new registration on <strong>$hostname.$domain</strong> has been made :</h3> |
<pre> |
@IP : $ip |
Hour : $time |
Login : $login |
Email : $Fmail |
</pre> |
<p><a href=\"https://$hostname\">$domain</a></p> |
</body> |
</html>"; |
$header = "From: $from\n"; |
345,27 → 362,22 |
$header .= "Content-type: text/html; charset=utf-8\n"; |
mail($to, $subject, $message, $header); |
} |
} else { |
//Le mot de passe est généré aléatoirement, si le mail n'est pas envoyé, on supprime le compte de la bdd ou on lui demande d'utiliser la page reset |
/* $link = da_sql_pconnect($config); |
// On smtp error, we remove the new user |
$link = da_sql_pconnect($config); |
$res2 = da_sql_query($link,$config, |
"DELETE FROM $config[sql_user_info_table] WHERE username = '$login';"); |
"DELETE FROM $config[sql_user_info_table] WHERE username = '$login';"); |
$res3 = da_sql_query($link,$config, |
"DELETE FROM $config[sql_check_table] WHERE username = '$login';"); |
// da_sql_close($link,$config) |
*/ |
echo "<b>Erreur lors de l'envoi du mail, veuillez renouveler votre inscription. Utilisez le formulaire de réinitialisation, ou contactez votre administrateur.</b><br />\n"; |
echo "<b>$l_mail_error</b><br />\n"; |
} |
} |
else // Could not open encryption library file |
echo "<b>Erreur lors de la création du compte</b><br />\n"; |
echo "<b>Error during the account creation process</b><br />\n"; |
} |
else // Could not connect to SQL database |
echo "<b>Erreur lors de la création du compte</b><br />\n"; |
echo "<b>Error during the account creation process</b><br />\n"; |
da_sql_close($link,$config); |
} |
} |
?> |