From 09a5dcd6ff9498dd0dc9adfd5a2dfd50771ae97b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= <grosse@cosmocode.de> Date: Tue, 27 Oct 2015 12:18:30 +0100 Subject: [PATCH] Show specific error messages if user creation fails --- lib/plugins/usermanager/admin.php | 11 +++++++++++ lib/plugins/usermanager/lang/en/lang.php | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index ca954db68..9314e395c 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -518,16 +518,20 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { $pass = auth_pwgen($user); } else { msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_missing_pass'], -1); return false; } } else { if (!$this->_verifyPassword($pass,$passconfirm)) { + msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_pass_not_identical'], -1); return false; } } } else { if (!empty($pass)){ msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_modPass_disabled'], -1); return false; } } @@ -535,10 +539,13 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { if ($this->_auth->canDo('modName')){ if (empty($name)){ msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_name_missing'], -1); return false; } } else { if (!empty($name)){ + msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_modName_disabled'], -1); return false; } } @@ -546,10 +553,13 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { if ($this->_auth->canDo('modMail')){ if (empty($mail)){ msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_mail_missing'], -1); return false; } } else { if (!empty($mail)){ + msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_modMail_disabled'], -1); return false; } } @@ -563,6 +573,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { } } else { msg($this->lang['add_fail'], -1); + msg($this->lang['addUser_error_create_event_failed'], -1); } return $ok; diff --git a/lib/plugins/usermanager/lang/en/lang.php b/lib/plugins/usermanager/lang/en/lang.php index b55ecc998..73abee37e 100644 --- a/lib/plugins/usermanager/lang/en/lang.php +++ b/lib/plugins/usermanager/lang/en/lang.php @@ -76,3 +76,11 @@ $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.'; $lang['import_downloadfailures'] = 'Download Failures as CSV for correction'; +$lang['addUser_error_missing_pass'] = 'Please either set a password or activate user notification to enable password generation.'; +$lang['addUser_error_pass_not_identical'] = 'The entered passwords were not identical.'; +$lang['addUser_error_modPass_disabled'] = 'Modifing passwords is currently disabled'; +$lang['addUser_error_name_missing'] = 'Please enter a name for the new user.'; +$lang['addUser_error_modName_disabled'] = 'Modifing names is currently disabled.'; +$lang['addUser_error_mail_missing'] = 'Please enter an Email-Adress for the new user.'; +$lang['addUser_error_modMail_disabled'] = 'Modifing Email-Adresses is currently disabled.'; +$lang['addUser_error_create_event_failed'] = 'The create UserMod event failed.'; -- GitLab