Skip to content
Snippets Groups Projects
Commit 328143f8 authored by Christopher Smith's avatar Christopher Smith
Browse files

enable email notifications & alert messages for imported users

parent ae1afd2f
No related branches found
No related tags found
No related merge requests found
......@@ -606,12 +606,16 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
/**
* send password change notification email
*/
function _notifyUser($user, $password) {
function _notifyUser($user, $password, $status_alert=true) {
if ($sent = auth_sendPassword($user,$password)) {
msg($this->lang['notify_ok'], 1);
if ($status_alert) {
msg($this->lang['notify_ok'], 1);
}
} else {
msg($this->lang['notify_fail'], -1);
if ($status_alert) {
msg($this->lang['notify_fail'], -1);
}
}
return $sent;
......@@ -770,7 +774,10 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
array_splice($raw,1,0,auth_pwgen()); // splice in a generated password
$clean = $this->_cleanImportUser($raw, $error);
if ($clean && $this->_addImportUser($clean, $error)) {
# $this->_notifyUser($clean[0],$clean[1]);
$sent = $this->_notifyUser($clean[0],$clean[1],false);
if (!$sent){
msg(sprintf($this->lang['import_notify_fail'],$clean[0],$clean[3]),-1);
}
$import_success_count++;
} else {
$import_fail_count++;
......@@ -817,9 +824,16 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
return false;
}
if (!($this->_auth->canDo('modMail') xor empty($mail))){
$error = $this->lang['import_error_badmail'];
return false;
if ($this->_auth->canDo('modMail')) {
if (empty($mail) || !mail_isvalid($mail)) {
$error = $this->lang['import_error_badmail'];
return false;
}
} else {
if (!empty($mail)) {
$error = $this->lang['import_error_badmail'];
return false;
}
}
return $cleaned;
......
......@@ -67,9 +67,10 @@ $lang['import_failure_count'] = 'User Import: %d failed. Failures are listed bel
$lang['import_error_fields'] = "Insufficient fields, found %d, require 4.";
$lang['import_error_baduserid'] = "User-id missing";
$lang['import_error_badname'] = 'Bad name';
$lang['import_error_badmail'] = 'Bad mail';
$lang['import_error_badmail'] = 'Bad email address';
$lang['import_error_upload'] = 'Import Failed. The csv file could not be uploaded or is empty.';
$lang['import_error_readfail'] = 'Import Failed. Unable to read uploaded file.';
$lang['import_error_create'] = 'Unable to create the user';
$lang['import_notify_fail'] = 'Notification message could not be sent for imported user, %s with email %s.';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment