mgo
OS/400 Edition
Volume 2, Number 63 -- August 21, 2002

Validating a User Password


Hey, Ted:

I have an application in which I would like to use electronic signatures. We are in a federally regulated industry and it is required to have this process password protected. To make things easy on the users I would like to use their normal AS/400 passwords. Is there a method for validating a user ID and password?


-- David

Take a look at the Check Password (CHKPWD) command. It requires one parameter: the password of the user profile under which it is running. If the password is not correct, CHKPWD sends one of the following escape messages:

CPF2362   Password not correct.

CPF2363   Only 1 attempt left to check password.

CPF2364   Maximum number of attempts to check password reached.

CHKPWD won't prompt you for the password, so you'll need to provide the user some way to enter it. The following display file DDS defines a non-display input field for that purpose:

A                                      DSPSIZ(24 80 *DS3)
A          R SCRN01
A                                  4  6'Enter your password to - 
A                                      continue:'
A            PWD           10A  I  4 40
A                                      DSPATR(ND)
A            MSG           78     24  2

This CL program prompts for the password and executes the CHKPWD command:

PGM                                                
                                                      
   DCLF       FILE(PWD1D)

RETRY:
   SNDRCVF
   CHKPWD PASSWORD(&PWD)
   MONMSG MSGID(CPF2362) EXEC(DO)
       CHGVAR VAR(&MSG) +
                VALUE('Invalid password; try again.')
       GOTO RETRY
   ENDDO

-- Ted


Sponsored By
COMMON

REGISTER FOR COMMON IN DENVER, OCT. 13-17

Get the IT training you need by attending COMMON Users Group's Fall 2002 IT Education Conference & Expo, October 13-17 in Denver. Early Bird registration is $1,150 until September 4.

Choose from over 720 sessions and labs covering a wide range of industry topics. Also receive training from J.D. Edwards, MAPICS, and other vendors.

Don't miss out! Go to www.common.org


THIS ISSUE
SPONSORED BY:

WorksRight Software
COMMON


BACK ISSUES

TABLE OF CONTENTS

Debugging Java in Eclipse

Validating a User Password

Reader Feedback and Insights: OPNQRYF Bug



Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris

Managing Editor
Mari Barrett

Publisher and
Advertising Director

Jenny Thomas

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com



Last Updated: 8/21/02
Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.