Skip to content

Commit

Permalink
Merge pull request #1381 from micgro42/adduserErrorMsg
Browse files Browse the repository at this point in the history
Show specific error messages if user creation fails
  • Loading branch information
splitbrain committed Oct 30, 2015
2 parents 07194c6 + 5e20405 commit 583a8a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/plugins/usermanager/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,38 +518,48 @@ protected function _addUser(){
$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;
}
}

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;
}
}

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;
}
}
Expand All @@ -563,6 +573,7 @@ protected function _addUser(){
}
} else {
msg($this->lang['add_fail'], -1);
msg($this->lang['addUser_error_create_event_failed'], -1);
}

return $ok;
Expand Down
8 changes: 8 additions & 0 deletions lib/plugins/usermanager/lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@
$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'] = 'A plugin prevented the new user being added. Review possible other messages for more information.';

0 comments on commit 583a8a6

Please sign in to comment.