Ticker

6/recent/ticker-posts

Password Validation in Oracle APEX with Example - Javainhand Tutorial

In this Oracle APEX Tutorial post, We will explore about the password validation in Oracle APEX with example.

Password Validation in Oracle Apex

As we know that most of the websites have their own password policy. This topic especially for beginners because whenever you create a signup or registration page you should knowledge of password policyIf you know about the password policy then you can easily implement password validation in Oracle APEX. 

Password Validation in Oracle APEX with Example

Before the start,  we give you a suggestion that you should learn REGEXP_LIKE first then started this implementation or if you already know about REGEXP_LIKE then you can easily understand Password Validation implementation.

In this implementation, we follow some patterns for password validation in Oracle APEX

  • ^.*[0-9]
  • ^.*[a-z]
  • ^.*[A-Z]
  • ^.*[!@#$%^&*()_]

Now we are explaining the above regular expressions pattern.

  • ^ This pattern used for Matches the beginning of the string.
  • .  This pattern used for Matches any character except NULL.
  • * This pattern used for Matches zero or more occurrence.
  • [] This pattern used for the specified matching list with the help of this pattern you can match any of the characters in the list.
  • c This pattern used for matches case-sensitive.
We will follow the below password policies in this section.
  • Password Length must be 8 characters and not more than 15 characters.
  • The password must have one numeric value.
  • The password must have one LowerCase.
  • The password must have one UpperCase.
  • The password must have one special character.


Now follow the below steps for Password Validation in Oracle Apex with Example.

Step 1:-Create a Page with a Password field Item and also create a button. Below Screenshot will help you out for better understand. But here I am choosing a text field item because at the end of the post I will share a demo link where you can easily do testing.


Step 2:- Now choose password type item, right-click with the mouse, and create a validation. The below screenshot will help you out to better understand.



Step 3:-After creating a validation choose PL/SQL Function Returning Error Text validation type and add below PL/SQL code in function returning error text section. Below Screenshot will help you out.


BEGIN
IF 8 <= LENGTH(:P22_PASSWORD) AND  LENGTH(:P22_PASSWORD) <= 15  THEN
    IF REGEXP_LIKE(:P22_PASSWORD, '^.*[0-9]') THEN
 IF REGEXP_LIKE(:P22_PASSWORD, '^.*[a-z]', 'c') THEN
 IF REGEXP_LIKE(:P22_PASSWORD, '^.*[A-Z]', 'c') THEN
 IF REGEXP_LIKE(:P22_PASSWORD, '^.*[!@#$%^&*()_]', 'c') THEN
 RETURN '';
 ELSE
    RETURN 'Password has not one special character';
 END IF;
 ELSE
    RETURN 'Password has not one UpperCase';
 END IF;   
 ELSE
    RETURN 'Password has not one LowerCase';
 END IF;
 ELSE
    RETURN 'Password has not a numeric value';
 END IF; 
ELSE
RETURN 'Password Length Must be min 8 char and max 15 char
and your password length is'||' '||LENGTH(:P22_PASSWORD);
END IF;

END;

Step 4:- Now you have to run your page and check that if you write the correct password then it will display a success message otherwise, it will display an error message. Below Screenshot will help you out for better understand.



Demo URL:-


If you like the Password Validation in Oracle APEX post then please share, and comment also.

Post a Comment

4 Comments

  1. RETURN 'Password has not one LowerCase';
    not work

    ReplyDelete
  2. Hi Javainhand,
    Any chance for testing this out on 21.1 Ive tried it and it doesn't seem to work like you are showing it in the demo, its the perfect bit of code that I need right now, if you can help that would be brilliant, thank you in advance.

    ReplyDelete

If you have any doubts, Please let me know