Friday, 1 August 2014

Reset APPS User Password from Back End

Reset APPS User Password from Back End 

Ask user for reset on first logon

This functionality is ask user to reset the password after logon

begin
fnd_user_pkg.updateuser(
x_user_name => ‘username’
, x_owner => ‘CUST’
, x_unencrypted_password => ‘welcome1012′,
x_password_date => to_date(’2′,’J’)
);
commit;
end;

Does not ask user for reset on first logon

-- Change password of TEST_USER to oracle123 (does not ask for reset on first logon)
BEGIN
   fnd_user_pkg.updateuser (x_user_name                   => 'TEST_USER',
x_owner => 'CUST',
x_unencrypted_password => 'oracle123',
                            x_end_date                    => fnd_user_pkg.null_date,
x_password_date => SYSDATE - 10,
                            x_password_accesses_left      => 10000,
                            x_password_lifespan_accesses  => 10000,
                            x_password_lifespan_days      => 10000
                           );
   COMMIT;
END;
Note: If the password is changed from the backend then the user will not be prompted to change his/her password on login screen.
The previous code uses a public API. We can use an Oracle private API to reset the password as well.

-- Change TEST_USER Password from PL/SQL
SET serverout on

DECLARE
   return_value   VARCHAR2 (200);
BEGIN
return_value := fnd_web_sec.change_password ('TEST_USER', 'oracle123');
   DBMS_OUTPUT.put_line ('Result ' || return_value);   -- Y Means Success Else Fail.
   COMMIT;
END;
You also execute the API as a SQL query


select fnd_web_sec.validate_login('SA1','etihad123') from dual;



No comments:

Post a Comment