瀏覽代碼

Restoring gpg key

Bob Mottram 9 年之前
父節點
當前提交
77d1641fe3
共有 1 個檔案被更改,包括 42 行新增23 行删除
  1. 42
    23
      src/freedombone-controlpanel

+ 42
- 23
src/freedombone-controlpanel 查看文件

@@ -309,6 +309,21 @@ function restore_data {
309 309
     any_key
310 310
 }
311 311
 
312
+function restore_data_remote {
313
+    any_key
314
+}
315
+
316
+function restore_gpg_key {
317
+    select_user
318
+    if [ ! $SELECTED_USERNAME ]; then
319
+        return
320
+    fi
321
+    dialog --title "Restore GPG key for user $SELECTED_USERNAME" --msgbox "Plug in your USB keydrive" 6 40
322
+    clear
323
+    freedombone-recoverkey -u $SELECTED_USERNAME
324
+    any_key
325
+}
326
+
312 327
 function menu_top_level {
313 328
     while true
314 329
     do
@@ -316,20 +331,22 @@ function menu_top_level {
316 331
         trap "rm -f $data" 0 1 2 5 15
317 332
         dialog --backtitle "Freedombone Control Panel" \
318 333
                --title "Control Panel" \
319
-               --radiolist "Choose an operation:" 20 70 13 \
334
+               --radiolist "Choose an operation:" 20 70 15 \
320 335
                1 "Backup data to USB drive" off \
321 336
                2 "Restore data from USB drive" off \
322
-               3 "Add a user" off \
323
-               4 "Delete a user" off \
324
-               5 "Change user password or ssh public key" off \
325
-               6 "Add a user to a mailing list" off \
326
-               7 "Add an email rule" off \
327
-               8 "Block/Unblock an email address" off \
328
-               9 "Block/Unblock email with subject text" off \
329
-               10 "Change security settings" off \
330
-               11 "Backup GPG key to USB drive (master keydrive)" off \
331
-               12 "Backup GPG key to USB drive (fragment keydrive)" off \
332
-               13 "Exit" on 2> $data
337
+               3 "Restore from remote backup" off \
338
+               4 "Add a user" off \
339
+               5 "Delete a user" off \
340
+               6 "Change user password" off \
341
+               7 "Add a user to a mailing list" off \
342
+               8 "Add an email rule" off \
343
+               9 "Block/Unblock an email address" off \
344
+               10 "Block/Unblock email with subject text" off \
345
+               11 "Change security settings" off \
346
+               12 "Backup GPG key to USB drive (master keydrive)" off \
347
+               13 "Backup GPG key to USB drive (fragment keydrive)" off \
348
+               14 "Restore GPG key from USB drive" off \
349
+               15 "Exit" on 2> $data
333 350
         sel=$?
334 351
         case $sel in
335 352
             1) exit 1;;
@@ -338,17 +355,19 @@ function menu_top_level {
338 355
         case $(cat $data) in
339 356
             1) backup_data;;
340 357
             2) restore_data;;
341
-            3) add_user;;
342
-            4) delete_user;;
343
-            5) change_password;;
344
-            6) add_to_mailing_list;;
345
-            7) email_rule;;
346
-            8) block_unblock_email;;
347
-            9) block_unblock_subject;;
348
-            10) freedombone-sec;;
349
-            11) create_keydrive_master;;
350
-            12) create_keydrive_fragment;;
351
-            13) break;;
358
+            3) restore_data_remote;;
359
+            4) add_user;;
360
+            5) delete_user;;
361
+            6) change_password;;
362
+            7) add_to_mailing_list;;
363
+            8) email_rule;;
364
+            9) block_unblock_email;;
365
+            10) block_unblock_subject;;
366
+            11) freedombone-sec;;
367
+            12) create_keydrive_master;;
368
+            13) create_keydrive_fragment;;
369
+            14) restore_gpg_key;;
370
+            15) break;;
352 371
         esac
353 372
     done
354 373
 }