Commit 5686c113 authored by Son Nguyen's avatar Son Nguyen Committed by Robert Lyon
Browse files

Fix error when adding an empty username. Bug 1438390

One should not be allowed to add an empty user to service access tokens
and/or service users in Web services admin section

Change-Id: I8d78a9400c08d9434387d66a273eadb846479cc2
parent ffdf7e84
......@@ -161,7 +161,7 @@ function webservices_token_submit(Pieform $form, $values) {
global $SESSION, $USER;
if ($values['action'] == 'generate') {
if (isset($values['userid'][0])) {
if (!empty($values['userid'][0])) {
$dbuser = get_record('usr', 'id', $values['userid'][0]);
if (!empty($dbuser)) {
$services = get_records_array('external_services', 'restrictedusers', 0);
......@@ -208,7 +208,7 @@ function webservices_user_submit(Pieform $form, $values) {
global $SESSION, $USER;
if ($values['action'] == 'add') {
if (isset($values['userid'][0])) {
if (!empty($values['userid'][0])) {
$dbuser = get_record('usr', 'id', $values['userid'][0]);
if ($auth_instance = webservice_validate_user($dbuser)) {
// make sure that this account is not already in use
......
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