Home » Developer & Programmer » Forms » Login
Login [message #169183] Tue, 25 April 2006 10:13 Go to next message
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 Go to previous messageGo to next message
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 #169188 is a reply to message #169184] Tue, 25 April 2006 10:40 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
PM Message.
Quote:

Basically what I am trying to do is create a Login screen for external users to to be able to login to a system with a username and password (that has already been stored in a USERS table).
This then allows them to access another canvas which would enable them to carry out the tasks they need to, which has already been created.

However, what I have done so far is I have created an IF THEN statement with a CONDITION that if the password and the username is TRUE then move to the next canvas.

If not then show an alert telling the user that the username or password is incorrect.

Private Message may not always get you a faster response.
Storing PASSSWORD in clear text is a big time security risk.
To answer your question ( As said before ) i have no idea about alerts/ whatever. Maybe someone in this forum should help
Re: Login [message #169211 is a reply to message #169188] Tue, 25 April 2006 14:49 Go to previous messageGo to next message
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 #169342 is a reply to message #169211] Wed, 26 April 2006 06:11 Go to previous messageGo to next message
mistry0071
Messages: 6
Registered: April 2006
Location: UK
Junior Member
Thanks! The coding works
Re: Login [message #169661 is a reply to message #169342] Fri, 28 April 2006 01:18 Go to previous message
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
  • Attachment: LOGIN_FRM.fmb
    (Size: 68.00KB, Downloaded 1053 times)
Previous Topic: form
Next Topic: BLONG in Forms
Goto Forum:
  


Current Time: Fri Sep 20 09:47:04 CDT 2024