Browse Source

Ask for the user account password first

Bob Mottram 7 years ago
parent
commit
dc0034286b
1 changed files with 23 additions and 17 deletions
  1. 23
    17
      src/freedombone-app-bdsmail

+ 23
- 17
src/freedombone-app-bdsmail View File

@@ -249,6 +249,28 @@ function install_bdsmail {
249 249
         remove_bdsmail
250 250
     fi
251 251
 
252
+    # ask to the ssh login password for the admin user
253
+    # This is then used to create the maildir account
254
+    user_account_password=''
255
+    data=$(tempfile 2>/dev/null)
256
+    trap "rm -f $data" 0 1 2 5 15
257
+    dialog --title $"Password" \
258
+           --clear \
259
+           --passwordbox $"Enter your ssh login password" 8 60 2> $data
260
+    ret=$?
261
+    case $ret in
262
+        0)
263
+            user_account_password=$(cat $data)
264
+            ;;
265
+    esac
266
+
267
+    if [ ${#user_account_password} -lt 2 ]; then
268
+        echo ''
269
+        echo $'A password must be provided for your user account.'
270
+        echo $'This is the same as the original ssh login password shown when you first installed the system.'
271
+        exit 3656358
272
+    fi
273
+
252 274
     if [ -d /repos/bdsmail ]; then
253 275
         mkdir $BDSMAIL_DIR
254 276
         cp -r -p /repos/bdsmail/. $BDSMAIL_DIR
@@ -369,23 +391,7 @@ function install_bdsmail {
369 391
 
370 392
     bdsmail_configure_users
371 393
 
372
-    # ask to the ssh login password for the admin user
373
-    # This is then used to create the maildir account
374
-    data=$(tempfile 2>/dev/null)
375
-    trap "rm -f $data" 0 1 2 5 15
376
-    dialog --title $"Password" \
377
-           --clear \
378
-           --passwordbox $"Enter your ssh login password" 8 60 2> $data
379
-    ret=$?
380
-    case $ret in
381
-        0)
382
-            $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p $(cat $data)
383
-            ;;
384
-        1)
385
-            exit 643856384;;
386
-        255)
387
-            exit 638762424;;
388
-    esac
394
+    $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p "$user_account_password"
389 395
 
390 396
     APP_INSTALLED=1
391 397
 }