Password input in Pick Basic

209 views
Skip to first unread message

Philip Klunk

unread,
Nov 24, 2014, 9:58:03 PM11/24/14
to mvd...@googlegroups.com
I'm looking for a routine that would take user input for a new password, but display only asterisks (or some other symbol) as the user types.  I have been using the ECHO OFF command, but that confuses users, since they don't see any results from their typing.  The IN function could work, but it doesn't seem to be very handy with the enter key.  Any suggestions?

Phil Klunk
mvBase

Steve Douglas

unread,
Nov 25, 2014, 9:09:36 AM11/25/14
to mvd...@googlegroups.com
You should be able to just have the user input 1 byte at a time while in ECHO OFF and display one * on each input.  Then collect those bytes into another variable until ENTER is pressed. But I may be missing something.
 
Please no flames from the group on any perceived poor programming practice but...
Something like...
PROMPT ''
TOTAL.INPUT = ''; RESP = 'X'
ECHO OFF
LOOP UNTIL RESP = ''
INPUT RESP,1
CRT '*':
GOSUB 900
REPEAT
CRT
CRT 'YOUR PASSWORD IS ':TOTAL.INPUT
ECHO ON
STOP
900 * INPUT LOOP *
TOTAL.INPUT := RESP
RETURN
 
Should display something like
*****
YOUR PASSWORD IS 1234

Martin Phillips

unread,
Nov 25, 2014, 9:53:34 AM11/25/14
to mvd...@googlegroups.com

Hi all,

 

Not much help to the original poster who is on mvBase but maybe useful for others, QM supports

   INPUT var, 20 HIDDEN

to show asterisks in place of the input data.

 

 

Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms

George Gallen

unread,
Nov 25, 2014, 11:03:33 AM11/25/14
to mvd...@googlegroups.com
The real fun begins when you want the backspace to function!
 
George
 

Date: Tue, 25 Nov 2014 06:09:36 -0800
From: sdou...@mbms.net

To: mvd...@googlegroups.com
Subject: [mvdbms] Re: Password input in Pick Basic

donr...@yahoo.com

unread,
Nov 25, 2014, 11:08:20 AM11/25/14
to mvd...@googlegroups.com
Philip,

Here's something I whipped up, it similar to Steve's with a couple of additions such as where to position the input field and maximum number of characters to accept, etc.
No guarantee to be bug free.
****************************************************
     GET.PASSWORD
0001 SUBROUTINE GET.PASSWORD(COLUMN, ROW, DLENGTH, PASSWORD)
0002 *
0003 * 11/25/2014, Don Robinson, donr...@yahoo.com
0004 *
0005 * This routine will accept input and display * in place of the
0006 * input characters.
0007 *
0008 PROMPT ''
0009 ECHO OFF
0010 PASSWORD = ''
0011 CRT @(COLUMN, ROW): STR(' ', DLENGTH): @(COLUMN, ROW)
0012 FOR X = 1 TO DLENGTH
0013    INPUT CHAR,1:
0014    IF CHAR = '' THEN EXIT
0015    PASSWORD := CHAR
0016    CRT @(COLUMN+LEN(PASSWORD), ROW): '*':
0017 NEXT X
0018 ECHO ON
0019 RETURN
************************************************************
Good luck,  
 
Don

donr...@yahoo.com

unread,
Nov 25, 2014, 11:12:57 AM11/25/14
to mvd...@googlegroups.com
Philip,

Add a ":" to line 11.
 
Don Robinson

MarioB

unread,
Nov 25, 2014, 11:37:55 PM11/25/14
to mvd...@googlegroups.com, gga...@live.com
Changing the input statement to:

     INPUT RESP,0

will allow certain control characters (backspace) to be detected and handled appropriately.

Tony Gravagno

unread,
Nov 26, 2014, 1:37:46 PM11/26/14
to mvd...@googlegroups.com
For D3 users, not mvBase:  The D3 Input command unfortunately does not have support for a password like QM. However, it does have a "fill expression" which handles the issue with backspaces. The idea is that if you have a prompt with 8 characters you might want to display 8 underscores, so as you enter data the underscores are overwritten, and if you backspace they are automatically replaced. I just tried using an asterisk within that fill.exp value. It does not achieve the goal desired for a password input, but I think this would be useful in other apps.

Another way to approach this - (untested, might be completely wrong) : If the end-user is using Accuterm, launch a window with SUI to do special kinds of input.

For the OP : many applications have a common input routine for the entire application. The code is called or Included. Eventually all Input statements are replaced with this routine which is enhanced over time to support special cases. I encourage this sort of development (perhaps using the code provided in this thread as a base), especially since it's a step toward abstracting an application from a character-based UI, separation of logic from UI, and on toward GUI.

T

Philip Klunk

unread,
Nov 26, 2014, 2:51:30 PM11/26/14
to mvd...@googlegroups.com
Thanks to Steve Douglas and Don Robinson for getting my engine started.  Here's my final code, which accommodates the backspace:
      SUBROUTINE GET.PASSWORD(COLUMN, ROW, DLENGTH, PASSWORD)
      *
      * 11/25/2014, Don Robinson, donr_work_at_yahoo.com
      * 11/26/2014, modified by Phil Klunk, phil.klunk_at_cenveo.com
      *

      * This routine will accept input and display * in place of the
      * input characters.
      *
      CR = CHAR(13)
      BS = CHAR(8)
      PROMPT ''
      ECHO OFF
      PASSWORD = ''
      CRT @(COLUMN, ROW): STR(' ', DLENGTH): @(COLUMN, ROW):

      FOR X = 1 TO DLENGTH
         INPUT CH,0:
         IF CH = CR THEN GOTO EXIT
         IF CH = BS THEN
            PASSWORD = PASSWORD[1,LEN(PASSWORD)-1]
         END ELSE
            PASSWORD := CH
         END
         CRT @(COLUMN,ROW):STR('*',LEN(PASSWORD)):STR(' ',DLENGTH-LEN(PASSWORD)):@(COLUMN+LEN(PASSWORD)):
      NEXT X
EXIT: *
      ECHO ON
      RETURN
      ************************************************************

keith....@datacom.co.nz

unread,
Dec 17, 2014, 10:14:10 PM12/17/14
to mvd...@googlegroups.com
Look up FINP program in PickWiki - it has a password entry section, although it does a lot more.
 
Regards, Keith

keith....@datacom.co.nz

unread,
Dec 17, 2014, 10:17:09 PM12/17/14
to mvd...@googlegroups.com
Sorry, It's titled FINP in the code, but it is under FieldInput in the BASIC source code section

Philip Klunk

unread,
Dec 17, 2014, 11:36:35 PM12/17/14
to mvd...@googlegroups.com
Thank you for the suggestion.

Phil Klunk

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms



--

Philip Klunk

unread,
Dec 17, 2014, 11:36:35 PM12/17/14
to mvd...@googlegroups.com
Found it.  Lotta code!

On Wed, Dec 17, 2014 at 10:17 PM, <keith....@datacom.co.nz> wrote:
Sorry, It's titled FINP in the code, but it is under FieldInput in the BASIC source code section

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms



--
Reply all
Reply to author
Forward
0 new messages