|
@@ -439,7 +439,7 @@ function add_gpg_key {
|
439
|
439
|
trap "rm -f $data" 0 1 2 5 15
|
440
|
440
|
dialog --title $"Add someone's PGP/GPG key" \
|
441
|
441
|
--backtitle $"Freedombone User Control Panel" \
|
442
|
|
- --inputbox $"Enter their email address or Key ID below" 8 60 2>$data
|
|
442
|
+ --inputbox $"Enter their email address, Key ID or full key below" 8 60 2>$data
|
443
|
443
|
sel=$?
|
444
|
444
|
case $sel in
|
445
|
445
|
0)
|
|
@@ -448,18 +448,29 @@ function add_gpg_key {
|
448
|
448
|
|
449
|
449
|
address_is_valid=
|
450
|
450
|
|
451
|
|
- if [[ $ADD_EMAIL_ADDRESS == *"@"* && $ADD_EMAIL_ADDRESS == *"."* ]]; then
|
|
451
|
+ if [[ "$ADD_EMAIL_ADDRESS" == *"@"* && "$ADD_EMAIL_ADDRESS" == *"."* ]]; then
|
|
452
|
+ address_is_valid=1
|
|
453
|
+ fi
|
|
454
|
+ if [[ "$ADD_EMAIL_ADDRESS" == "0x"* ]]; then
|
|
455
|
+ address_is_valid=1
|
|
456
|
+ fi
|
|
457
|
+ publicstr=$"BEGIN PGP PUBLIC KEY BLOCK"
|
|
458
|
+ if [[ "$ADD_EMAIL_ADDRESS" == *"$publicstr"* ]]; then
|
452
|
459
|
address_is_valid=1
|
453
|
|
- else
|
454
|
|
- if [[ $ADD_EMAIL_ADDRESS == "0x"* ]]; then
|
455
|
|
- address_is_valid=1
|
456
|
|
- fi
|
457
|
460
|
fi
|
458
|
461
|
|
|
462
|
+
|
459
|
463
|
if [ $address_is_valid ]; then
|
460
|
464
|
clear
|
461
|
|
- gpg --search-keys "$ADD_EMAIL_ADDRESS"
|
462
|
|
- gpg_set_trust "$ADD_EMAIL_ADDRESS"
|
|
465
|
+ if [[ "$ADD_EMAIL_ADDRESS" == *"$publicstr"* ]]; then
|
|
466
|
+ echo "$ADD_EMAIL_ADDRESS" | gpg --import
|
|
467
|
+ dialog --title $"Add someone's PGP/GPG key" \
|
|
468
|
+ --backtitle $"Freedombone User Control Panel" \
|
|
469
|
+ --msgbox $"GPG public key was imported" 6 50
|
|
470
|
+ else
|
|
471
|
+ gpg --search-keys "$ADD_EMAIL_ADDRESS"
|
|
472
|
+ gpg_set_trust "$ADD_EMAIL_ADDRESS"
|
|
473
|
+ fi
|
463
|
474
|
else
|
464
|
475
|
dialog --title $"Unrecognised email address" \
|
465
|
476
|
--backtitle $"Freedombone User Control Panel" \
|