Consultor Eletrônico



Kbase P16847: How to change another users database password within an appl
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/25/2003
Status: Unverified

GOAL:

How to change another users database password within an application

FIX:

This example uses 3 fill-ins;

Fill-in-1 For the USER ID
Fill-in-2 For the old Password
Fill-in-3 For the new Password.

It also assume there is only one Database connected. LDBNAME(1) can be changed to a variable, hardcoded or use another number (LDBNAME(2)) as needed.

NOTE: It is reccomended that you make the user imput the new password two times to varify the spelling.


Define variable vsetuserid as character NO-UNDO.


DO:
vsetuserid = setuserid(fill-in-1,fill-in-2, LDBNAME(1)).
CASE vsetuserid:
WHEN FALSE THEN
MESSAGE "Sorry Password was not correct".
WHEN TRUE THEN DO:
find first _user where _user._userid = fill-in-1 no-error.
If available(_user) then
assign _user._password = encode(fill-in-3).
IF setuserid(fill-in-1,fill-in-3,"sportspw") = TRUE THEN
MESSAGE "Password Update was successful".
ELSE
MESSAGE "Password Update was unsuccessful".
END.
END CASE.
END.