Page 1 of 1

TOraSession.ChangePassword doesn't work (5.55.1.24)

Posted: Mon 19 Dec 2005 13:30
by stefanmeisner
Doesn't work if session is not connected.
However, this should be easy to fix:


//----------------------------------------------------------------------------
//2005-12-19 14:05 N,??:
//2005-12-19 14:05 B,SM B3587: try/finally used (to return connection)
// using SetUserName/SetPassword if not connected

procedure TOraSession.ChangePassword(NewPassword: string);
begin
CreateIConnection;
try //B3587
//B3587 begin
if not Connected then
begin
FIConnection.SetUsername(Username);
FIConnection.SetPassword(Password);
end;
//B3587 end
FIConnection.ChangePassword(NewPassword);
FPassword := NewPassword;
FIConnection.SetPassword(PChar(FPassword));
finally //B3587
if not Connected and (FIConnection.Pool nil) then begin
ConnectionPoolManager.ReturnConnection(FIConnection);
SetIConnection(nil);
end;
end;
end;


Regards
Stefan Meisner

Posted: Tue 20 Dec 2005 09:58
by Challenger
Odac needs Connect method to be called before ChangePassord is called to set
all necessary internal connection settings. If you are Pro-version user you can
change ChangePassord procedure as you want but we will not support these changes.

ChangePassword

Posted: Tue 20 Dec 2005 10:01
by stefanmeisner
Suppose, the user can't connect due to an expired password he won't be able to connect and thus be unable to change his/her password.
This has been the reason to apply this fix.
Greetings
Stefan Meisner

Posted: Wed 21 Dec 2005 08:19
by Challenger
When user tries to connect with expired password TOraSession raises
an exception. But it would be enough to call ChangePassword procedure. So you can use try...except block or OnError event handler to catch this exception and if needed call ChangePassword.