Password Reset: Add email message to Email Templates.

This commit is contained in:
Nate 2019-03-13 23:30:39 -06:00
parent 978dd8342e
commit a35f618ec2
6 changed files with 112 additions and 27 deletions

View File

@ -27,7 +27,7 @@
//if the number of rows is 0 then read the sip profile xml into the database
if ($domains_processed == 1) {
//add the sip profiles to the database
//add the email templates to the database
$sql = "select count(*) as num_rows from v_email_templates ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
@ -268,7 +268,7 @@
$array['email_templates'][$x]['template_body'] .= "<body>\n";
$array['email_templates'][$x]['template_body'] = "Missed Call from \${caller_id_name} &lt;<a href=\"tel:\${caller_id_number}\">\${caller_id_number}</a>&gt; to \${sip_to_user} ext \${dialed_user}\n";
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_description'] = '';
@ -321,7 +321,7 @@
$database->save($array);
//$message = $database->message;
unset($array);
//remove the temporary permission
$p->delete("email_template_add", 'temp');
$p->delete("email_template_edit", 'temp');

View File

@ -218,7 +218,7 @@
echo " ".$text['label-template_body']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <textarea class='formfld' name='template_body' rows='8' style='width: 100%'>".escape($template_body)."</textarea>\n";
echo " <textarea class='formfld' name='template_body' style='min-width: 100%; height: 350px; font-family: monospace;'>".escape($template_body)."</textarea>\n";
echo "<br />\n";
echo $text['description-template_body']."\n";
echo "</td>\n";

View File

@ -761,26 +761,6 @@ $text['label-reset_password']['ru-ru'] = "Сброс пароля";
$text['label-reset_password']['sv-se'] = "Återställ Lösenord";
$text['label-reset_password']['uk-ua'] = "Скинути пароль";
$text['label-reset_link']['en-us'] = "Password Reset Link";
$text['label-reset_link']['ar-eg'] = " رابط اعادة تعيين كلمة السر";
$text['label-reset_link']['de-at'] = "Link zum Zurücksetzen des Passworts"; //copied from de-de
$text['label-reset_link']['de-ch'] = "Link zum Zurücksetzen des Passworts"; //copied from de-de
$text['label-reset_link']['de-de'] = "Link zum Zurücksetzen des Passworts";
$text['label-reset_link']['es-cl'] = "Password Reset Enlace";
$text['label-reset_link']['es-mx'] = "Password Reset Enlace"; //copied from es-cl
$text['label-reset_link']['fr-ca'] = "Lien de réinitialisation du mot de passe"; //copied from fr-fr
$text['label-reset_link']['fr-fr'] = "Lien de réinitialisation du mot de passe";
$text['label-reset_link']['he-il'] = "קישור לאיפוס סיסמה";
$text['label-reset_link']['it-it'] = "Link per il Reset della Password";
$text['label-reset_link']['nl-nl'] = "";
$text['label-reset_link']['pl-pl'] = "Link do resetowania hasla";
$text['label-reset_link']['pt-br'] = "Link para redefinir senha";
$text['label-reset_link']['pt-pt'] = "Password Reset Link";
$text['label-reset_link']['ro-ro'] = "Link resetare parolă";
$text['label-reset_link']['ru-ru'] = "Ссылка для сброса пароля";
$text['label-reset_link']['sv-se'] = "Länk för Återställning av Lösenord";
$text['label-reset_link']['uk-ua'] = "Посилання на скидання пароля";
$text['label-repeat_password']['en-us'] = "Repeat Password";
$text['label-repeat_password']['ar-eg'] = "تاكيد كلمة السر";
$text['label-repeat_password']['de-at'] = "Passwort wiederholen"; //copied from de-de

View File

@ -84,6 +84,52 @@ if ($domains_processed == 1) {
unset ($prep_statement);
}
//insert default password reset email template
if (file_exists($_SERVER['DOCUMENT_ROOT'].'/app/email_templates')) {
//build the array
$x = 0;
$array['email_templates'][$x]['email_template_uuid'] = '05b529c4-fba7-4071-bab3-143b076392e7';
$array['email_templates'][$x]['template_language'] = 'en-us';
$array['email_templates'][$x]['template_category'] = 'password_reset';
$array['email_templates'][$x]['template_subcategory'] = 'default';
$array['email_templates'][$x]['template_subject'] = 'Password Reset';
$array['email_templates'][$x]['template_body'] .= "<html>\n";
$array['email_templates'][$x]['template_body'] .= "<body>\n";
$array['email_templates'][$x]['template_body'] .= "<center><a href='https://\${domain}'><img src='\${logo_full}' style='width: 200px; height: auto; border: none;'></a></center><br />\n";
$array['email_templates'][$x]['template_body'] .= "A password reset was just requested for the FusionPBX user account associated with this email address.<br /><br />\n";
$array['email_templates'][$x]['template_body'] .= "<b>If you submitted this request</b>, click the button below to begin the password reset process for your user account.<br /><br />";
$array['email_templates'][$x]['template_body'] .= "\${reset_button}<br /><br />\n";
$array['email_templates'][$x]['template_body'] .= "If you did not initiate this action, however, please ignore this message and your password will remain unchanged.\n";
$array['email_templates'][$x]['template_body'] .= "If you have questions or concerns regarding this email, please contact your system administrator.";
$array['email_templates'][$x]['template_body'] .= "<br /><br /><br />\n";
$array['email_templates'][$x]['template_body'] .= "<a href='https://\${domain}'><img src='\${logo_shield}' width='31' height='30' border='0' align='left' style='margin-top: 3px; margin-right: 5px;'></a>\n";
$array['email_templates'][$x]['template_body'] .= "<i><b>FusionPBX</b></i><br />\n";
$array['email_templates'][$x]['template_body'] .= "<a href='https://\${domain}'>\${domain}</a>\n";
$array['email_templates'][$x]['template_body'] .= "<br /><br /><br />\n";
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_description'] = 'Default password reset email template.';
$x++;
//add the temporary permission
$p = new permissions;
$p->add("email_template_add", 'temp');
$p->add("email_template_edit", 'temp');
//save to the data
$database = new database;
$database->app_name = 'email_templates';
$database->app_uuid = '8173e738-2523-46d5-8943-13883befd2fd';
$database->save($array);
unset($array);
//remove the temporary permission
$p->delete("email_template_add", 'temp');
$p->delete("email_template_edit", 'temp');
}
}
?>

View File

@ -2038,5 +2038,41 @@ function number_pad($number,$n) {
}
}
//define email button (src: https://buttons.cm)
if (!function_exists('email_button')) {
function email_button($text = 'Click Here!', $link = URL, $bg_color = '#dddddd', $fg_color = '#000000', $radius = '') {
// default button radius
$radius = $radius != '' ? $radius : '3px';
// retrieve single/first numeric radius value for ms arc
$tmp = $radius;
if (substr_count($radius, ' ') > 0) {
$tmp = explode(' ', $radius);
$tmp = $tmp[0];
}
$tmp = preg_replace("/[^0-9,.]/", '', $tmp); // remove non-numeric characters
$arc = floor($tmp / 35 * 100); // calculate percentage
// create button code
$btn = "
<div>
<!--[if mso]>
<v:roundrect xmlns:v='urn:schemas-microsoft-com:vml' xmlns:w='urn:schemas-microsoft-com:office:word' href='".$link."' style='height: 35px; v-text-anchor: middle; width: 140px;' arcsize='".$arc."%' stroke='f' fillcolor='".$bg_color."'>
<w:anchorlock/>
<center>
<![endif]-->
<a href='".$link."' style='background-color: ".$bg_color."; border-radius: ".$radius."; color: ".$fg_color."; display: inline-block; font-family: sans-serif; font-size: 13px; font-weight: bold; line-height: 35px; text-align: center; text-decoration: none; width: 140px; -webkit-text-size-adjust: none;'>".$text."</a>
<!--[if mso]>
</center>
</v:roundrect>
<![endif]-->
</div>
";
return $btn;
}
}
?>

File diff suppressed because one or more lines are too long