How to compare the current password encrypted pasword enter APEX4.1

Hi all
In my application uses the following package
create or replace PACKAGE BODY app_security_pkg
AS
PROCEDURE login 
          (
           p_uname IN VARCHAR2
          ,p_password IN VARCHAR2
          ,p_session_id IN VARCHAR2
          ,p_flow_page IN VARCHAR2
          )
IS
 lv_goto_page NUMBER DEFAULT 1;
BEGIN
 
 -- This logic is a demonstration of how to redirect 
 -- to different pages depending on who successfully 
 -- authenticates. In my example, it simply demonstrates 
 -- the ADMIN user going to page 1 and all other users going
 -- to page 2. Add you own logic here to detrmin which page 
 -- a user should be directed to post authentication.
 IF UPPER(p_uname) = 'ADMIN'
 THEN
  lv_goto_page := 1;
 ELSE
  lv_goto_page := 2;
 END IF;

APEX_UTIL.SET_SESSION_STATE('FSP_AFTER_LOGIN_URL');

 wwv_flow_custom_auth_std.login 
 (
  p_uname => p_uname,
  p_password => p_password,
  p_session_id => p_session_id,
  p_flow_page => p_flow_page || ':' || lv_goto_page
  );

EXCEPTION
WHEN OTHERS
THEN 
 RAISE;
END login;

PROCEDURE add_user 
(
 p_username IN VARCHAR2
,p_password IN VARCHAR2
)
AS
BEGIN
INSERT INTO app_users (username, PASSWORD)
    VALUES (UPPER (p_username),
        get_hash (TRIM (p_username), p_password));

COMMIT;

EXCEPTION
WHEN OTHERS
THEN 
 ROLLBACK; 
 RAISE;
END add_user;

-- Function to Perform a oneway hash of the users 
-- passwords. This cannot be reversed. This exmaple 
-- is a very week hash and if been used on a production 
-- system, you may want to use a stronger hash algorithm.
-- Read the Documentation for more info on DBMS_CRYPTO as 
-- this is the supported package from Oracle and 
-- DBMS_OBFUSCATION_TOOLKIT is now depricated.
FUNCTION get_hash (p_username IN VARCHAR2, p_password IN VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
RETURN DBMS_OBFUSCATION_TOOLKIT.md5 (
input_string => UPPER (p_username) 
                || '/' 
                || UPPER (p_password));
END get_hash;

PROCEDURE valid_user2 (p_username IN VARCHAR2, p_password IN VARCHAR2)
AS
v_dummy VARCHAR2 (1);
BEGIN
SELECT '1'
INTO v_dummy
FROM app_users
WHERE UPPER (username) = UPPER (p_username)
AND PASSWORD = get_hash (p_username, p_password);
EXCEPTION
WHEN NO_DATA_FOUND
THEN raise_application_error (-20000, 'Invalid username / password.');
END valid_user2;

FUNCTION valid_user (p_username IN VARCHAR2, p_password IN VARCHAR2)
RETURN BOOLEAN
AS
BEGIN
valid_user2 (UPPER (p_username), p_password);
RETURN TRUE;
EXCEPTION
WHEN OTHERS
THEN RETURN FALSE;
END valid_user;

END app_security_pkg;
Here the ADD_USER procedure will convert the password and stores in the Table app_users in encrypted form.

In my application, users can change their password,
So I need to compare the password entering the Current_password field with the password encrypted in the app_users table.
So I used the following code,
declare
  l_x varchar2(30);
begin
  select username into l_x
        from app_users
    where upper(username) = upper(:P7_USERNAME)
      and password = :P7_CURRENT_PASSWORD;
  return (true);
exception
  when no_data_found then
    return (false);
end;
This code works fine when the password is stored without encryption, but it displays error, after encryption

because the password entered is simply password and not encrypted if the two are different even if the user enters the correct password.

Please tel me how encrypt the entered password to compare with the encrypted password.

Thank you
Kind regards
gurujothi.

Hi guru,.

When you say comparing it is obvious that both must be in the same format, so either you have to compare both encrypted or not encrypted.

Do you have an example on apex.oracle.com?

Thank you

Tags: Database

Similar Questions

  • Lost admin password, how to retrieve the current password to change it?

    I forgot my Admin password, I connect on my laptop using the scanner print finger all the time and when I try to change the password for Admin it ask the password which I do not remember. How to retrieve the current password and change it in Windows 7 Home premium?

    It's a laptop Acer 5738 G

    You can change your current password as follows:

    1. click on start.
    2. type the three letters cmd in the search box.
    3. press on Ctrl + Shift + Enter
    4. click on "run as Administrator".
    5. type the following command and press ENTER after each:
    NET user "user %%nom" 123456

    Now the password is 123456. While dealing with accounts and passwords: having a single admin account on a PC is about the same as having a unique key for your car. What happens if you lose? He lost? Break it? A robust Windows Setup requires at least the following:

    • Two admin accounts fully tested, with their passwords to record on paper.
    • A password key file. Click Start / Help, then search for help on "password". Follow the instructions to create a key on your USB flash drive file so that you'll never find yourself in this uncomfortable situation.
  • How to compare the LDAP password

    Hello

    I am able to bind to the LDAP connection using the program java and able to search the DN of the user and get the userPassword attribute. I get encrypted password. My question is what is the encryption algorithm should I use to convert my password in plain text to compare with the password LDAP attribute?

    You do not compare the password entered with the LDAP password. You try to authenticate to the LDAP server as long as that user with the entered password. If you succeed, the password is correct. This is what is called an LDAP "bind" operation, not to be confused with the JNDI 'bind '. In JNDI, it's a reconnect().

  • How get/compare the current value in a business rule?

    Dear all,

    How can I do this in the planning by using calculation Manager, I have an account named "service_years", I want to write:

    IF 'Service_Years' > 5
    account_xyz = 1000;
    Endif;

    How can the logic above to convert in the accepted syntax? because it is not applicable to such if condition directly on a member.

    Thank you.

    VR;

    If service_years == 5

    ;-)

    Kind regards
    André

  • HP mini 110 computer: enter the current password

    Hello! I have a problem with my computer hp mini 110. It asks me to enter the current password and I entered all the possible passwords that I could remember... The p/n is:-VA714UA #ABA. Model number: HP mini 110-1030NR. What should I do?

  • How do I get it: ENTER the CURRENT PASSWORD

    How can I down it. ENTER THE CURRENT PASSWORD
    I don't know what I need. my brother would have done anything and now it shows me only.
    My English is not very good at writing google translator, but I hope it's always obvious

    Hello

    It's the BIOS password.
    If the BIOS password has been set, this window appears and BIOS prompt you to enter the password.
    You know this password?

    If you n t know this password, then you will need to ask the technician to Toshiba ASP to remove this item.

  • How to create a disc of forgotten password if you must have the current password?

    It makes no sense at all.  How to create a disc of forgotten password if you must have the current password?  It works only if you have created this from the beginning? Thank you

    Original title: Assistant password

    "How to enable or disable the built-in high administrator in Windows 7 account '

    http://www.SevenForums.com/tutorials/507-built-administrator-account-enable-disable.html

    'Activate the administrator account (hidden) on Windows 7, 8, or Vistone '

    http://www.howtogeek.com/HOWTO/Windows-Vista/enable-the-hidden-administrator-account-on-Windows-Vista/

    See you soon.

  • How to disable the BIOS password

    Hi Please help me, my hp Pavilion dv6-2112sa always ask me password of Directors whenever I have on my computer.i password but do not know how to disable the it.pls help

    Hello

    You can remove the need for a power on password as follows.

    Shut down the laptop.  Now on TAP the ESC key as soon as you press the power button to access the start menu, then select f10 to open the Bios menu.  Use the arrows to select the Security tab and press ENTER.  Use the arrow keys again to highlight the power on password and press ENTER.  Enter the current password and then for the new password, just leave this blank and press on enter – do the same for the confirmation field.  Press f10, select this option to save the new settings and press to enter.

    Kind regards

    DP - K

  • HP Pavilion touchsmart 14 n04: how to disable the bios password

    1.i do not know how to disable bios password help me please.

    I remember my bios password, but I am not as he asks me if I opened my HP

    my hp Pavilion touchsmart 14 n042tx product

    2.i have to donwgrade 8 window to window 7 help me if I want to switch to the window 8. I lose window8 CD

    thx a lot

    Hello

    You can remove the need for a power on password as follows.

    Shut down the laptop.  Now on TAP the ESC key as soon as you press the power button to access the start menu, then select f10 to open the Bios menu.  Use the arrows to select the Security tab and press ENTER.  Use the arrow keys again to highlight the power on password and press ENTER.  Enter the current password and then the new password, simply leave this blank and press on enter - do the same for the confirmation field.  Press f10, select this option to save the new settings and press to enter.

    What about being able to reinstall Windows 8, you can order a replacement set of recovery media - see the following link for more details.

    Order HP recovery disks.

    Kind regards

    DP - K

  • Unable to connect using the current password

    Using the current password which only had 6 characters - have now changed to 8 hope if this helps solve the problem.
    Have you noticed too there was an update of Mozilla on my laptop the day before that this problem then this could be the reason?

    Unable to connect using the current password

    It is far from a complete problem description.
    Please explain in detail

    • what you were doing
    • That's happened

    Using the current password which only had 6 characters

    6 characters is a very weak password. Consider using a password manager to generate longer and more complex passwords and to remember these passwords.

  • Enter the current password for HP Compaq Mini CQ10

    Hi, can you please help me with the problem of "enter the current password?

    cnu00554x8

    Hello

    Use the codes below to reset

    e9l11qqv4u
    e9l11qqvru (3rd letter is L)

  • HP mini 110-1115nr - how to reset the bios password?

    Hi Please help me for my hp mini 1115nr 110

    s/n: [personal information deleted]

    P/N; VM136UA #ABA

    problem of SME pls help me to password.thanks a lot

    Try to Jason.

    e9lovqqwqu

    3rd letter tiny L.

    4th letter lowercase O.

    6th, 7th, and 9th Q lowercase letter.

    Use this code to go into the BIOS.

    Disable all passwords that are enabled.

    When asked for the CURRENT password using this code.

    When asked for the password just press ENTER.

    If asked to hit just to CHECK password to enter.

    Save and exit.

    REO

    I must inform you that these services are not endorsed by HP, and that HP is not responsible for any damages that may occur to your system using these services. Please be aware that you do so at your own risk.

  • Satellite P20-304 - how to remove the BIOS password

    Hi all

    a girlfriend of mine got a Satellite P20 304 with Phoenix Bios.
    She wanted that I remove the Bios password that must be entered directly after the Toshiba start screen.
    So, I entered Bios with F2, went to security, entered the old password and press enter two times to a new blank password.

    The Bios then showed that user password is not defined.
    I saved the changes and started to laptop came out, and asked me again a password.
    Now no entry (only press enter) or the old password works, still displays "wrong password".

    What I did wrong?

    I am a COMPUTER technician, but never had a problem like this.
    This problem is related to the Bios Phoenix or Toshiba? And how to solve the problem?

    Can anyone help? Would be fine, girlfriend needs urgent laptop.

    Thanks for the comments!

  • How to compare the 2 versions of the same document in Pages?

    How to compare the 2 versions of the same document on Pages?

    There is no OS X Visual tool which can open two Pages document and show the differences between them - other than the human eye.

    What information are you interested in identify as different between the two documents? What specific version of Pages?

  • Satellite A110-260 - how to remove the BIOS password

    Hello

    I have a password for the Toshiba Satellite A110-260, but I can't reset the password of the battery

    Please help me!

    How to reset the bios password

    You cannot remove the BIOS password. Something like that is not possible on Toshiba laptops.
    A special procedure is required and this can be done ONLY by a (certified partner) ASP.

    So my advice is to contact the ASP in your country and ask for help!

Maybe you are looking for

  • USB 2.0 M30X problems

    Hello It seems that the Toshiba Satellite m30x has a USB bug. Some USB 2.0 devices are detected at 5 times per minute when they are well connected and the worst: they are recognized as a USB 1.1 device, although it is a USB 2.0. I have tried everythi

  • HP Mini 110 rese of bios password

  • My speakers stopped working. Not detected in Control Panel

    My speakers just stopped working, now when I connect, I get a found new hardware message (pci device) but when I apply the wizard, he found nothing. In my control panel, it has not detected speaker. I lost my drivers somehow? I have Norton Antivirus.

  • Laserjet pro m477fnw color: Color laserjet pro m477fnw is possible to add a duplex?

    Hi all I have buyed a laserjet pro m477fnw Color and, unfortunately, I have found that two-sided (duplex) printing is only manual. Is possible to buy a compatible duplex and attach it to the printer? In the past, I remember some printers hp with this

  • Is it possible to restore Office Starter 2010?

    Hey there! I'm having a problem. Well, no problem, but a gene I recently bought a HP Dv6. It came with various pre-installed software, Office Starter 2010 has been one of them. I had to recover my computer through HP System Recovery due to problems.