DBA Data[Home] [Help]

PACKAGE BODY: APPS.POS_PASSWORD_UTIL_PKG

Source


1 PACKAGE BODY POS_PASSWORD_UTIL_PKG AS
2 /*$Header: POSPWUTB.pls 120.1 2005/08/09 15:33:14 bitang noship $ */
3 
4 --
5 -- private function that removes adjacent repeating characters in a string
6 --
7 FUNCTION remove_repeating_char(
8   p_string IN VARCHAR2
9 ) RETURN VARCHAR2
10 IS
11 lv_string VARCHAR2(3000);
12 ln_counter NUMBER;
13 BEGIN
14   IF p_string IS NOT NULL THEN
15     ln_counter := 1;
16     lv_string := p_string;
17     WHILE ln_counter < length(lv_string) LOOP
18       IF substr(lv_string, ln_counter+1, 1) = substr(lv_string, ln_counter, 1) THEN
19         lv_string := substr(lv_string, 1, ln_counter) || substr(lv_string, ln_counter+2);
20       ELSE
21 	ln_counter := ln_counter + 1;
22       END IF;
23     END LOOP;
24     RETURN lv_string;
25   END IF;
26   RETURN NULL;
27 END remove_repeating_char;
28 
29 FUNCTION generate_user_pwd
30 RETURN VARCHAR2
31 IS
32 
33 lv_pwd VARCHAR2(200);
34 lv_status VARCHAR2(30);
35 
36 lv_signon_pwd_length fnd_profile_option_values.profile_option_value%TYPE;
37 lv_signon_pwd_hardguess fnd_profile_option_values.profile_option_value%TYPE;
38 ln_pwd_length NUMBER := 5;
39 
40 BEGIN
41 
42   lv_signon_pwd_length := fnd_profile.value('SIGNON_PASSWORD_LENGTH');
43 
44   IF lv_signon_pwd_length IS NOT NULL THEN
45     BEGIN
46       ln_pwd_length := to_number(lv_signon_pwd_length);
47     EXCEPTION
48       WHEN OTHERS THEN
49 	ln_pwd_length := 5;
50     END;
51   END IF;
52 
53   lv_pwd := substr(remove_repeating_char('P1' || substr(icx_call.encrypt(fnd_crypto.smallrandomnumber), 4)), 1, ln_pwd_length+1);
54 
55   -- just in case the previous encryption has too many repetitive charaters
56   WHILE length(lv_pwd) < ln_pwd_length LOOP
57     lv_pwd := lv_pwd || lv_pwd;
58   END LOOP;
59 
60   RETURN lv_pwd;
61 
62 END generate_user_pwd;
63 
64 
65 END POS_PASSWORD_UTIL_PKG;