From 6f5e7b211009bf3a5b6816ee3cb064d7f393dfb9 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Date: Fri, 18 Sep 2015 23:01:01 -0500
Subject: Streamline cryptographic card logon process

---
 tdm/kfrontend/kgreeter.cpp | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

(limited to 'tdm/kfrontend/kgreeter.cpp')

diff --git a/tdm/kfrontend/kgreeter.cpp b/tdm/kfrontend/kgreeter.cpp
index 15b325898..e14e58491 100644
--- a/tdm/kfrontend/kgreeter.cpp
+++ b/tdm/kfrontend/kgreeter.cpp
@@ -899,9 +899,16 @@ void KGreeter::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) {
 			// pam_pkcs11 is extremely chatty with no apparent way to disable the unwanted messages
 			verify->setInfoMessageDisplay(false);
 
-			// Initiate login
+			// Set up password prompt
 			cardLoginUser = login_name;
-			verify->accept();
+			verify->setPasswordPrompt(i18n("PIN:"));
+
+			TQString autoPIN = cdevice->autoPIN(); 
+			if (autoPIN != TQString::null) {
+				// Initiate login
+				verify->setPassword(autoPIN);
+				verify->accept();
+			}
 		}
 	}
 }
@@ -910,6 +917,7 @@ void KGreeter::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) {
 	cardLoginUser = TQString::null;
 	verify->lockUserEntry(false);
         verify->requestAbort();
+        verify->setPasswordPrompt(TQString::null);
 
 	// Restore information message display settings
         verify->setInfoMessageDisplay(showInfoMessages);
@@ -1128,8 +1136,9 @@ KThemedGreeter::KThemedGreeter()
 	xauth_warning = themer->findNode( "xauth-warning" ); // tdm ext
 	pam_error = themer->findNode( "pam-error" );
 	timed_label = themer->findNode( "timed-label" );
-	if (pam_error && pam_error->isA( "KdmLabel" ))
+	if (pam_error && pam_error->isA( "KdmLabel" )) {
 		static_cast<KdmLabel*>(pam_error)->setText( i18n("Login Failed.") );
+	}
 
 	KdmItem *itm;
 	if ((itm = themer->findNode( "pam-message" ))) // done via msgboxes
@@ -1291,6 +1300,10 @@ KThemedGreeter::updateStatus( bool fail, bool caps, int timedleft )
 			timed_label->hide( true );
 		}
 	}
+
+	if (cardLoginUser != TQString::null) {
+		verify->setPasswordPrompt(i18n("PIN:"));
+	}
 }
 
 void
-- 
cgit v1.2.1