Commit 0ddee8ff authored by Dries's avatar Dries
Browse files

- Patch #10718 by drumm: bugfix: it was possible to save a user with no roles assigned when the form clearly said at least one was required. The result of saving that was silently leaving the roles unchanged, which is rather bad.
parent b75c1e1c
......@@ -1041,6 +1041,12 @@ function user_edit_validate($uid, &$edit) {
form_set_error('mail', t('The e-mail address %e-mail has been denied access.', array('%e-mail' => '<em>'. $edit['mail'] .'</em>')));
}
// Validate the roles
if (!$edit['roles']) {
form_set_error('roles', t('You must select at least one role.'));
$edit['roles'] = array();
}
// If required, validate the uploaded picture.
if ($file = file_check_upload('picture')) {
$user = user_load(array('uid' => $uid));
......
......@@ -1041,6 +1041,12 @@ function user_edit_validate($uid, &$edit) {
form_set_error('mail', t('The e-mail address %e-mail has been denied access.', array('%e-mail' => '<em>'. $edit['mail'] .'</em>')));
}
// Validate the roles
if (!$edit['roles']) {
form_set_error('roles', t('You must select at least one role.'));
$edit['roles'] = array();
}
// If required, validate the uploaded picture.
if ($file = file_check_upload('picture')) {
$user = user_load(array('uid' => $uid));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment