masking a password field in v9.1d

Posted by Admin on 30-Jan-2007 11:08

First off i was wondering if there was and easier way of masking the password fields on a login screen in version 9.1d i know there is for newer versions but not sure about our current version.

This is how we did it on a trigger

DO.

CASE KEYFUNCTION(LASTKEY):

WHEN "DELETE-CHARACTER" THEN

DO:

/* Remove last char from password and last "*" from fill-in. */

IF LENGTH(pword) > 0 THEN

DO:

pword = SUBSTRING(pword,1,(LENGTH(pword) - 1)).

pwd:SCREEN-VALUE =

SUBSTRING(pwd:SCREEN-VALUE,1,

LENGTH(pwd:SCREEN-VALUE) - 1).

pwd:CURSOR-OFFSET = LENGTH(pwd:SCREEN-VALUE) + 1.

RETURN NO-APPLY.

END.

END.

WHEN "BACKSPACE" THEN

DO:

/* Remove last char from password and last "*" from fill-in. */

IF LENGTH(pword) > 0 THEN

DO:

pword = SUBSTRING(pword,1,(LENGTH(pword) - 1)).

pwd:SCREEN-VALUE =

SUBSTRING(pwd:SCREEN-VALUE,1,

LENGTH(pwd:SCREEN-VALUE) - 1).

pwd:CURSOR-OFFSET = LENGTH(pwd:SCREEN-VALUE) + 1.

RETURN NO-APPLY.

END.

END.

WHEN "RETURN" THEN DO:

/* User believes password is correct -- validate password. */

APPLY "entry" TO button-ok.

/* Your validation code here. */

RETURN NO-APPLY.

END.

WHEN "TAB" THEN DO:

/* User believes password is correct -- validate password. */

/* Your validation code here. */

RETURN NO-APPLY.

END.

WHEN "END-ERROR" THEN DO:

/* END-ERROR */

RETURN NO-APPLY.

END.

OTHERWISE DO:

/* check for printable character */

IF KEYCODE(KEYFUNCTION(LASTKEY)) > 0 AND

KEYCODE(KEYFUNCTION(LASTKEY)) < 200

THEN DO:

/* Build password from input & display "*" in fill-in. */

pword = pword + KEYFUNCTION(LASTKEY).

pwd:SCREEN-VALUE = pwd:SCREEN-VALUE + "*".

pwd:CURSOR-OFFSET = LENGTH(pwd:SCREEN-VALUE) + 1.

/* pwd:CURSOR-OFFSET = pwd:CURSOR-OFFSET + 2. */

RETURN NO-APPLY.

END.

ELSE RETURN NO-APPLY. /* ignore non-printables */

END.

END CASE.

END.

Also we are having trouble when it wont let you tab out of the password field is there any way to fix that?

All Replies

Posted by Tim Kuehn on 30-Jan-2007 11:54

Try the "BLANK" attribute.

Posted by Admin on 30-Jan-2007 13:14

yeah we have been using the blank for awhile now and we were looking to mask it with ******* and thats why i was wondering. That way we have asterisks instead of a blank field.

Posted by jmls on 31-Jan-2007 01:49

have a look at http://oehive.org/node/475

Posted by Admin on 01-Feb-2007 07:56

Thanks i completely forgot about oehive, i found some nice things over there.

This thread is closed