[Home] [Help]
PACKAGE BODY: APPS.POS_PASSWORD_UTIL_PKG
Source
1 PACKAGE BODY POS_PASSWORD_UTIL_PKG AS
2 /*$Header: POSPWUTB.pls 120.1.12010000.2 2009/02/26 07:45:11 dashah ship $ */
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 ln_tmp_str varchar2(255);
40
41 BEGIN
42
43 lv_signon_pwd_length := fnd_profile.value('SIGNON_PASSWORD_LENGTH');
44
45 IF lv_signon_pwd_length IS NOT NULL THEN
46 BEGIN
47 ln_pwd_length := to_number(lv_signon_pwd_length);
48 EXCEPTION
49 WHEN OTHERS THEN
50 ln_pwd_length := 5;
51 END;
52 END IF;
53 /*As part of fix 8288119 : changes foward ported from 11i Bugs 5599028,7257014*/
54 ln_tmp_str := nchr(mod(fnd_crypto.smallrandomnumber(),26)+65) ||
55 nchr(mod(fnd_crypto.smallrandomnumber(),26)+97) ||
56 mod(fnd_crypto.smallrandomnumber(),10) ||
57 substr('%,^!#$*()-_+;:,|?', mod(fnd_crypto.smallrandomnumber(), 17), 1) ;
58 lv_pwd := substr(remove_repeating_char(ln_tmp_str || substr(icx_call.encrypt(fnd_crypto.smallrandomnumber), 4)), 1, ln_pwd_length+1);
59
60 /*As part of fix 8288119 : changes foward ported from 11i Bugs 5599028,7257014*/
61
62
63 -- just in case the previous encryption has too many repetitive charaters
64 WHILE length(lv_pwd) < ln_pwd_length LOOP
65 lv_pwd := lv_pwd || lv_pwd;
66 END LOOP;
67
68 RETURN lv_pwd;
69
70 END generate_user_pwd;
71
72
73 END POS_PASSWORD_UTIL_PKG;