Login [message #169183] |
Tue, 25 April 2006 10:13 |
mistry0071
Messages: 6 Registered: April 2006 Location: UK
|
Junior Member |
|
|
Does anyone know how to create a login screen that allows users to input a username and password?? Which if the password is insertede and is correct they move onto another canvas if not then it brings up an alerts stating that the password is wrong or username.
I've coded the following coding in a when button pressed trigger:
Declare
user_name varchar2(10);
USER_PASSWORD VARCHAR2(10);
alert_button number;
Cursor Login Is
Select USERS.USER_NAME, USERS.USER_PASSWORD
From USERS
Where USERS.USER_NAME = :LOGIN.USER_NAME_TXT And USERS.USER_PASSWORD = :LOGIN.PASSWORD_TXT;
BEGIN
OPEN LOGIN;
IF :LOGIN.USER_NAME_TXT = 'true' AND USER_PASSWORD = 'true'
THEN
GO_BLOCK('MENU');
else
if :LOGIN.USER_NAME_TXT = 'TRUE' AND USER_PASSWORD = 'false'
THEN alert_button := SHOW_ALERT('CK_ERROR');
-- IF alert_button = alert_button1 THEN
-- EXIT_FORM;
END IF;
CLOSE LOGIN;
END IF;
-- END IF;
END;
It complies the coding but does not work.
I have a text item called user_name_txt where the user inserts the username and another text item called password_txt where they enter the password. The login button is then pressed to allow the user to move onto the next canvas if the data entered is correct.
Where am i going wrong? Please help. Thanks
|
|
|
Re: Login [message #169184 is a reply to message #169183] |
Tue, 25 April 2006 10:19 |
|
Mahesh Rajendran
Messages: 10707 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
>> USERS.USER_PASSWORD = :LOGIN.PASSWORD_TXT;
I am not into forms/report/whatever front-end you are using.
For the above code to work, you must be storing the password in clear text.
Are you?
What is the whole idea here?
EDIT: Moved to Forms forums
[Updated on: Tue, 25 April 2006 10:20] Report message to a moderator
|
|
|
|
Re: Login [message #169211 is a reply to message #169188] |
Tue, 25 April 2006 14:49 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Wouldn't you rather create a real Oracle user and let Oracle care about credentials?
If you insist on your solution, I'd like to say a few words: to make a password "invisible", set "Conceal Data" item property to YES - it will result in stars (****) when user enters his password.
WHEN-BUTTON-PRESSED trigger is, in my opinion, wrong (you said that it doesn't work as well). What's wrong about it? IF condition doesn't make sense:
IF :LOGIN.USER_NAME_TXT = 'true' AND USER_PASSWORD = 'true'
It expects user to enter a string 'true' into both items, and I doubt that this was your idea - I guess you wanted to check whether username and password are correct (that is, 'true') and proceed with form execution.
You don't need cursor at all, as you don't do anything with it and, besides that, it really isn't necessary - could be used, but complicates things without reason.
If you don't have alerts, use a simple MESSAGE.
The simplest way to check whether entered credentials are correct is to check both of them; if you are willing to develop it further, go on and check all three wrong combinations:
- both UN and PW are wrong,
- UN is OK but PW isn't and
- UN is wrong but PW is OK
This is just an example code:select 'x' into :global.dummy
from users
where user_name = :users.user_name
and user_password = :users.user_password;
message('Username and password are correct - go to next canvas');
go_item('a_block_on_another_canvas.first_item')
exception
when no_data_found then
message('Username and/or password are incorrect');
raise form_trigger_failure;
|
|
|
|
Re: Login [message #169661 is a reply to message #169342] |
Fri, 28 April 2006 01:18 |
ahmad_uaf
Messages: 68 Registered: March 2006 Location: Pakistan
|
Member |
|
|
Hello
This is form based on external user as well.
I think it will help u .
Regards,
Ahmad
|
|
|