using EXEC_SQL.Is_Connected [message #325063] |
Wed, 04 June 2008 23:19  |
|
Programaticaly i run the logout; procedure on a button press and the user is sent to a customized LOGIN form. but still when i test the using EXEC_SQL.Is_Connected flag, it returns true.
What i intend to do is:
Create a customized Login Form (instead of the default logon_screen) and allowing the user to connect to the oracle DB & when login out, it should be disconnected from the DB.
|
|
|
|
Re: using EXEC_SQL.Is_Connected [message #325077 is a reply to message #325066] |
Wed, 04 June 2008 23:48   |
|
can you guide what logic i should be following to achieve it?
the form provides to fields (plz refer to the attached snap)
the TNS name is hard coded behind.
when the signin is pressed, the user is authenticated via logon function, then i examine the value of is_connected flag, which then returns true. and the user is redirected to another form.
but when the user is logs out (via logout) the flag still represents the value "true" and even if wrong user name/password is given (2nd time loggin in)the user is redirected to the main form.
so what actually i should test to see if the user is authorized or not.
|
|
|
|
|
Re: using EXEC_SQL.Is_Connected [message #325109 is a reply to message #325080] |
Thu, 05 June 2008 01:00   |
|
anacedent wrote on Thu, 05 June 2008 09:54 | >even if wrong user name/password is given (2nd time loggin in)the user is redirected to the main form.
This smells like an implementation issue.
Upon presentation of LOGIN form, why not NULL out the password & enforce password validation before proceeding?
|
i would like to add that,
2nd time when user go inside, opening new forms and navigation is open, however when F8/execute_query is initiated then forms show the Error message, that connection to database is required.
so when users logs out (logout;) the is connected flag does not represents the current connection status correctly.
here is a sample code
=========================
PROCEDURE LOGIN_OUT IS
pl_id paramlist;
COUNTER NUMBER := 0;
SALES_FORM_COUNT NUMBER := :global.sales_counter;
BEGIN
CLS_FORM('NAME_COMP_MOTOR');
CLS_FORM('ITEMS');
CLS_FORM('PURCHASE_FORM');
FOR counter IN 0..SALES_FORM_COUNT LOOP
CLS_FORM('SALES_FORM');
END LOOP;
CLS_FORM('SALES_FORM');
CLS_FORM('ACCOUNTS_FORM');
CLS_FORM('TRANS');
CLS_FORM('RENT_A_BIKE');
--CLS_FORM('MAIN_FORM');
logout;
pl_id := Get_Parameter_List('FRM');
IF NOT ID_NULL(PL_ID) THEN
DESTROY_Parameter_List(PL_ID);
END IF;
PL_ID := Create_Parameter_List('FRM');
Add_Parameter(PL_ID,'DIRPATH',TEXT_PARAMETER,:GLOBAL.DIR);
NEW_FORM(:GLOBAL.DIR||'LOGIN_FORM.fmx',TO_SAVEPOINT,NO_QUERY_ONLY,NO_SHARE_LIBRARY_DATA,PL_ID);
END;
=======================
CLS_FORM PROCEDURE IS AS FOLLOWS
==========================
PROCEDURE cls_form(frmname in varchar2) IS
form_id formmodule;
BEGIN
FORM_ID := find_FORM(FRMNAME);
IF NOT ID_NULL(FORM_ID) THEN
CLOSE_FORM(FORM_ID);
-- GO_FORM(FORM_ID);
END IF;
END;
[Updated on: Thu, 05 June 2008 01:10] Report message to a moderator
|
|
|
|
|
|
Re: using EXEC_SQL.Is_Connected [message #340442 is a reply to message #325063] |
Tue, 12 August 2008 22:29   |
|
In the code above.
after closing all other form except the main main form.
i call the logout; proceedure.
(this should disconnect from the database)
then i use the New_Form proceedure to open the Login form. (this closes the main form )
now the is_coonected flag should be false this time, but still it shows true and the user log inside to the application even if wrong user name and password is given. (seems as the user still connected to the application.)
|
|
|
|
Re: using EXEC_SQL.Is_Connected [message #341671 is a reply to message #325063] |
Tue, 19 August 2008 21:59   |
|
please read the code below
======================
note:- currently as i mentioned that m just closing all forms on pressing of log out button.
earlier when i was (as discussed above) calling the login form via new_form procedure, its code is marked in comments
DECLARE
pl_id paramlist;
username varchar2 (255);
userpass varchar2 (255);
connstring varchar2 (255);
isconnected boolean := FALSE;
BEGIN
-- logout;
-- EXEC_SQL.Close_Connection();
/*
get_connect_info(username,userpass,connstring);
message(username||'/'||userpass||'@'||connstring);
message(username||'/'||userpass||'@'||connstring);
*/
logon ('', '');
-- login();
isconnected := EXEC_SQL.Is_Connected ();
if (isconnected) then
/*
message('connected');
message('connected');
*/
begin
PL_ID := Create_Parameter_List ('FRM');
Add_Parameter (PL_ID, 'DIRECT', TEXT_PARAMETER, 'NO');
Add_Parameter (PL_ID, 'DIRPATH', TEXT_PARAMETER, :PARAMETER.DIRPATH);
NEW_FORM (:PARAMETER.DIRPATH || 'MAIN_FORM.fmx',
TO_SAVEPOINT,
NO_QUERY_ONLY,
NO_SHARE_LIBRARY_DATA,
PL_ID);
end;
else
message ('! connected');
message ('! connected');
end if;
exception
when EXEC_SQL.Invalid_Connection then
message ('Sorry invalid username / password');
message ('Sorry invalid username / password');
clear_form;
END;
the above code fires when the user preses the signin button after filling the usename & password from the login form. [EDITED by DJM: fixed crappy formatting]
[Updated on: Thu, 21 August 2008 00:52] by Moderator Report message to a moderator
|
|
|
|
Re: using EXEC_SQL.Is_Connected [message #341832 is a reply to message #341718] |
Wed, 20 August 2008 08:43   |
|
for simplicity consider two forms.
1. login form,
2. the welcome /main form (with log out button)
in both forms the evet occurs on button pressing.
login form has a sign in button.
welcome form has log out button.
the last code which i wrote is executed when the sign in button will be pressed.
(note it will be fired in two casses :
a: user login for the forst time
b: user login, logout, then login
login ==> welcome form ==> logout button ==> login form ==> re logins
)
======================
when the user presses the logout button (on welcome form) i programaticaly close all other forms (sales form can be opened several times and a global couter tracks the sales form cout - for the rest forms, they are restricted to be open of maximum 1 time) after closing all forms call to procedure logout is executed. then the new_form procedure is used to call the login form and one cycle completes.
==========================
since as i mentioned that i could not solve the problem the current code behind the logut button closes all forms along with welcome form and does not invokes the login form (thats y i've commented the close connection statement)
|
|
|
|
Re: using EXEC_SQL.Is_Connected [message #343097 is a reply to message #341999] |
Tue, 26 August 2008 05:00   |
|
the current code behind the Logout Button on welcome form is (i call this proceedure) :
PROCEDURE LOGIN_OUT IS
COUNTER NUMBER := 0;
SALES_FORM_COUNT NUMBER := :global.sales_counter;
isconnected boolean;
BEGIN
CLS_FORM('NAME_COMP_GAMES');
CLS_FORM('ITEMS');
CLS_FORM('PURCHASE_FORM');
FOR counter IN 0..SALES_FORM_COUNT LOOP
CLS_FORM('SALES_FORM');
END LOOP;
CLS_FORM('SALES_FORM');
CLS_FORM('ACCOUNTS_FORM');
CLS_FORM('TRANS');
CLS_FORM('MAIN_FORM');
END;
==============
m closing the welcome form ( CLS_FORM('MAIN_FORM'); ) as RE-LOGIN was not working correctly.
===============
the current code behind the login form sign in button is :
DECLARE
pl_id paramlist;
username varchar2(255);
userpass varchar2(255);
connstring varchar2(255);
isconnected boolean := FALSE;
BEGIN
-- logout;
-- EXEC_SQL.Close_Connection();
/*
get_connect_info(username,userpass,connstring);
message(username||'/'||userpass||'@'||connstring);
message(username||'/'||userpass||'@'||connstring);
*/
logon('','');
-- login();
isconnected := EXEC_SQL.Is_Connected();
if (isconnected) then
/*
message('connected');
message('connected');
*/
begin
PL_ID := Create_Parameter_List('FRM');
Add_Parameter(PL_ID,'DIRECT',TEXT_PARAMETER,'NO');
Add_Parameter(PL_ID,'DIRPATH',TEXT_PARAMETER,:PARAMETER.DIRPATH);
NEW_FORM(:PARAMETER.DIRPATH||'MAIN_FORM.fmx',TO_SAVEPOINT,
NO_QUERY_ONLY,NO_SHARE_LIBRARY_DATA,PL_ID);
end;
else
message('! connected');
message('! connected');
end if;
exception when EXEC_SQL.Invalid_Connection then
message('Sorry invalid username / password');
message('Sorry invalid username / password');
clear_form;
END;
[EDITED by DJM: fixed 'too long' line]
[Updated on: Mon, 01 September 2008 00:57] by Moderator Report message to a moderator
|
|
|
|
Re: using EXEC_SQL.Is_Connected [message #345336 is a reply to message #325063] |
Wed, 03 September 2008 02:17   |
|
the first code in my last post was of Login_out procedure...
the CLS_From code is below, this procedure closes the indicated form.
PROCEDURE cls_form(frmname in varchar2) IS
form_id formmodule;
BEGIN
FORM_ID := find_FORM(FRMNAME);
IF NOT ID_NULL(FORM_ID) THEN
CLOSE_FORM(FORM_ID);
-- GO_FORM(FORM_ID);
END IF;
END;
|
|
|
|