Browse Source

If there is only one valid user then don't show selection

Bob Mottram 8 years ago
parent
commit
a9d8d0576d
2 changed files with 14 additions and 6 deletions
  1. 7
    3
      src/freedombone-config
  2. 7
    3
      src/freedombone-controlpanel

+ 7
- 3
src/freedombone-config View File

@@ -1309,10 +1309,14 @@ function select_user {
1309 1309
         fi
1310 1310
     done
1311 1311
 
1312
-    user_index=$(dialog --backtitle $"Freedombone Configuration" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
1312
+    if [ $i -eq 1 ]; then
1313
+        SELECTED_USERNAME="${name[0]}"
1314
+    else
1315
+        user_index=$(dialog --backtitle $"Freedombone Configuration" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
1313 1316
 
1314
-    if [ $? -eq 0 ]; then
1315
-        SELECTED_USERNAME="${name[$((user_index-1))]}"
1317
+        if [ $? -eq 0 ]; then
1318
+            SELECTED_USERNAME="${name[$((user_index-1))]}"
1319
+        fi
1316 1320
     fi
1317 1321
 }
1318 1322
 

+ 7
- 3
src/freedombone-controlpanel View File

@@ -403,10 +403,14 @@ function select_user {
403 403
         fi
404 404
     done
405 405
 
406
-    user_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
406
+    if [ $i -eq 1 ]; then
407
+        SELECTED_USERNAME="${name[0]}"
408
+    else
409
+        user_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
407 410
 
408
-    if [ $? -eq 0 ]; then
409
-        SELECTED_USERNAME="${name[$((user_index-1))]}"
411
+        if [ $? -eq 0 ]; then
412
+            SELECTED_USERNAME="${name[$((user_index-1))]}"
413
+        fi
410 414
     fi
411 415
 }
412 416