From 79c6087da52c77cd7e2b730363b5daeb8b5467b1 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 29 Jul 2011 15:36:22 -0500 Subject: [PATCH] Added scripts to resend passwords and get user details - disabled by default, manual enable required --- main/cron/user_import/get_data_from_mail.php | 35 +++++++++++ .../resend_email_with_new_password.php | 59 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 main/cron/user_import/get_data_from_mail.php create mode 100644 main/cron/user_import/resend_email_with_new_password.php diff --git a/main/cron/user_import/get_data_from_mail.php b/main/cron/user_import/get_data_from_mail.php new file mode 100644 index 0000000000..07b455a4fb --- /dev/null +++ b/main/cron/user_import/get_data_from_mail.php @@ -0,0 +1,35 @@ +$row['firstname'],'LastName'=>$row['lastname'],'UserName'=>$row['username'],'Password'=>$pass,'Email'=>$mail); + $l = api_get_interface_language(); + if (!empty($row['language'])) { + $l = $row['language']; + } + //This comes from main/admin/user_import.php::save_data() slightly modified + $recipient_name = api_get_person_name($user['FirstName'], $user['LastName'], null, PERSON_NAME_EMAIL_ADDRESS); + $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg',null,$l).' '.api_get_setting('siteName'); + $emailbody = get_lang('Dear',null,$l).' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg',null,$l)." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings',null,$l)."\n\n".get_lang('Username',null,$l)." : ".$user['UserName']."\n".get_lang('Pass',null,$l)." : ".$user['Password']."\n\n".get_lang('Address',null,$l)." ".api_get_setting('siteName')." ".get_lang('Is',null,$l)." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem',null,$l)."\n\n".get_lang('Formula',null,$l).",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager',null,$l)." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email',null,$l)." : ".api_get_setting('emailAdministrator').""; + $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); + $email_admin = api_get_setting('emailAdministrator'); + @api_mail($recipient_name, $user['Email'], $emailsubject, $emailbody, $sender_name, $email_admin); + echo "[OK] Sent to $mail with new password $pass (encrypted:$crypass)... w/ subject: $emailsubject\n"; + } +}