Sfoglia il codice sorgente

Add gpg email address or key ID

Sometimes on a profile people only give their key ID
Bob Mottram 8 anni fa
parent
commit
e6583a18a3
No account linked to committer's email
1 ha cambiato i file con 13 aggiunte e 2 eliminazioni
  1. 13
    2
      src/freedombone-controlpanel-user

+ 13
- 2
src/freedombone-controlpanel-user Vedi File

@@ -375,19 +375,30 @@ function add_gpg_key {
375 375
 	trap "rm -f $data" 0 1 2 5 15
376 376
 	dialog --title $"Add someone's PGP/GPG key" \
377 377
 		   --backtitle $"Freedombone User Control Panel" \
378
-		   --inputbox $"Enter their email address below" 8 60 2>$data
378
+		   --inputbox $"Enter their email address or Key ID below" 8 60 2>$data
379 379
 	sel=$?
380 380
 	case $sel in
381 381
 		0)
382 382
 			ADD_EMAIL_ADDRESS=$(<$data)
383 383
 			if [ ${#ADD_EMAIL_ADDRESS} -gt 2 ]; then
384
+
385
+				address_is_valid=
386
+
384 387
 				if [[ $ADD_EMAIL_ADDRESS == *"@"* && $ADD_EMAIL_ADDRESS == *"."* ]]; then
388
+					address_is_valid=1
389
+				else
390
+					if [[ $ADD_EMAIL_ADDRESS == "0x"* ]]; then
391
+						address_is_valid=1
392
+					fi
393
+				fi
394
+
395
+				if [ $address_is_valid ]; then
385 396
 					clear
386 397
 					gpg --search-keys $ADD_EMAIL_ADDRESS
387 398
 				else
388 399
 					dialog --title $"Unrecognised email address" \
389 400
 						   --backtitle $"Freedombone User Control Panel" \
390
-						   --msgbox $"This doesn't look like an email address" 6 50
401
+						   --msgbox $"This doesn't look like an email address or key ID" 6 50
391 402
 				fi
392 403
 			fi
393 404
 			;;