Home » Developer & Programmer » Forms » Problem setting up usernames and password
Problem setting up usernames and password [message #115690] Wed, 13 April 2005 11:52 Go to next message
Zack
Messages: 2
Registered: April 2005
Location: Leeds
Junior Member
Hi

I am designing a database using oracle 9i as the database and form builder 9i as the front end, i have designed the database and it runs fine with the forms created. Ive got a form that has a user name and password option, at the moment it allows you to login using any user name and password even if the user name and password are not listed in my tables. I right clicked on the submit button and but some coding in the When button pressed trigger, still does not check my user name and password in my tables before allowing the user to go onto the next screen, it just allows anyone to put any details in and press submit to go onto the next screen, i was wondering if anyone has the correct coding to put in the trigger when button pressed for it to check my user table before allowing people to go onto the next screen.

Ive checked through several books i.e oracle 9i developer and also guide to oracle9i.

Please help

Thanks

Zack
Re: Problem setting up usernames and password [message #115754 is a reply to message #115690] Thu, 14 April 2005 03:47 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Check out the 'Logon' statement in the Form Builder Help file. It contaisn the following example. It also has a third parameter: <quote>
logon_screen_ on_error:
An optional BOOLEAN parameter that, when set to TRUE (default), causes
Form Builder to automatically display the logon screen if the logon
specified fails (usually because of a incorrect username/password). When
logon_screen_on_error is set to FALSE and the logon fails, the logon
screen will not display and FORMS_FAILURE is set to TRUE so the
designer can handle the condition in an appropriate manner.
</quote>

/*
** Built-in: LOGON
** Example: Perform Form Builder standard logon to the ORACLE
** database. Decide whether to use Form Builder
** built-in processing or a user exit by consulting a
** global flag setup at startup by the form,
** perhaps based on a parameter. This example
** uses the 'Get_Connect_Info' procedure from the
** GET_APPLICATION_PROPERTY example.
** Trigger: On-Logon
*/
DECLARE
un VARCHAR2(80);
pw VARCHAR2(80);
cn VARCHAR2(80);
BEGIN
/*
** Get the connection info
*/
Get_Connect_Info(un,pw,cn);
/*
** If at startup we set the flag to tell our form that we
** are not running against ORACLE, then call our
** appropriate MY_LOGON userexit to logon.
*/
IF :Global.Non_Oracle_Datasource = 'TRUE' THEN
User_Exit('my_logon username='||un||' password='||pw);
/*
** Otherwise, call the LOGON built-in
*/
ELSE
IF cn IS NOT NULL THEN
LOGON(un,pw||'@'||cn);
ELSE
LOGON(un,pw);
END IF;
END IF;
END;
Re: Problem setting up usernames and password [message #115760 is a reply to message #115690] Thu, 14 April 2005 04:31 Go to previous messageGo to next message
subba lakshmi
Messages: 36
Registered: March 2005
Member
take two blocks
1. give text boxes to enter login and password
2. take a button

on button write this code:

declare
cursor curname is select columnname(of login) from tablename;
varlog tablename.loginfield%Type:=null;--variable to store login
varpwd tablename.pwdfield%type:=null; --var. to store pwd
begin
open curname;
loop
fetch curname into varlog;
if varlog=:Block3.txtlogin then
select pwdfieldvalue into varpwd from tablename
where login=varlog;
if varpwd=:Block3.txtpwd then
Clear_Message;
call_form('give you formname.fmx');
else
Clear_Message;
Message('Invlaid pwd!!!');
Message('Invlaid pwd!!!');
exit;
end if;
else
Go_Block('Block2'); --block where button is placed
next_record;
end if;
exit when curlog%notfound;
end loop;
close curname;
end;



try it out

from
lakshmi
Re: Problem setting up usernames and password [message #115817 is a reply to message #115760] Thu, 14 April 2005 10:02 Go to previous messageGo to next message
Zack
Messages: 2
Registered: April 2005
Location: Leeds
Junior Member
Hi Lakshi

Thanks for your help and support. I am still having some problems, i changed your coding to make my username and password work. Here is my coding in my button:

My username Variable name is User_ID
My password Variable is Password
My user table is called User_Info

declare
cursor curname is select User_ID from User_Info;
User_ID User_Info.User_ID%Type:=null;--variable to store login
Password User_Info.Password%type:=null; --var. to store pwd
begin
open curname;
loop
fetch curname into User_ID;
if User_ID=:User_Info.User_ID then
select Password into Password from User_info
where User_ID=User_ID;
if Password=:User_Info.Password then
Clear_Message;
CALL_FORM(:GLOBAL.project_path || 'MMenu.fmx'); -- page i want to appear if login successful
else
Clear_Message;
Message('Invalid pwd!!!');
Message('Invalid pwd!!!');
exit;
end if;
else
Go_Block('USER_INFO'); --block where button is placed
next_record;
end if;
end loop;
close curname;
end;

At the moment with the above coding i do not get an error but the button does not do anything.

Please Advise Thanks
Re: Problem setting up usernames and password [message #116074 is a reply to message #115817] Sun, 17 April 2005 08:13 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
And I still wonder why you don't create apllication users in Oracle. It allows you to define security on user level. You can apply menu role security. You don't have to store passwords in your tables...

MHE
Previous Topic: Restrict The User From Input any Value
Next Topic: CURSOR STYLE
Goto Forum:
  


Current Time: Thu Sep 19 17:59:51 CDT 2024