DBA Data[Home] [Help]

PACKAGE BODY: APPS.JTF_UM_FORGOT_PASSWD

Source


1 package body JTF_UM_FORGOT_PASSWD as
2 /* $Header: JTFVUPWB.pls 115.17 2004/05/12 20:10:10 kchervel ship $ */
3 
4 
5 /**
6  * Procedure   :  generate_password
7  * Type        :  Private
8  * Pre_reqs    :
9  * Description : Creates a password. The length of the password is obtained from the profile
10  *               SIGNON_PASSWORD_LENGTH.
11  * Parameters
12  * input parameters : None
13  * output parameters
14  * @return   returns a String that can be used as the password
15   * Errors      :
16  * Other Comments :
17  */
18 
19 function generate_password return varchar2 is
20 
21   l_password_len   int := 6;
22   x_password   varchar2(50);
23   ascii_offset     int     := 65;
24 
25 begin
26 
27      -- initialize the random number generator
28      dbms_random.initialize(dbms_utility.get_time);
29 
30      -- using the profile, determine the length of the random number
31      l_password_len := greatest(nvl(fnd_profile.value('SIGNON_PASSWORD_LENGTH'), l_password_len), l_password_len);
32 
33     -- generate a random number to determine where to use an alphabet or a
34     -- numeric character for a given position in the password
35 
36     for j in 1..l_password_len loop
37       if (mod(abs(dbms_random.random),2) = 1) then
38         -- generate number
39         x_password := x_password || mod(abs(dbms_random.random),10);
40       else
41         -- generate character
42         x_password := x_password || fnd_global.local_chr(mod(abs(dbms_random.random),26)
43                  + ascii_offset);
44       end if;
45     end loop;
46 
47     -- terminate the random number generator
48     dbms_random.terminate;
49 
50     return x_password;
51 
52 end generate_password;
53 
54 
55 Procedure SetPassword_WF(itemtype  in varchar2,
56                       itemkey   in varchar2,
57                       actid     in number,
58                       funcmode  in varchar2,
59                       resultout in out  NOCOPY varchar2) is
60    l_password varchar2(40);
61    l_user_name varchar2(360);
62    l_result varchar2(10);
63    v_counter BINARY_INTEGER := 1;
64 
65 begin
66    if (funcmode = 'RUN') then
67       l_password := generate_password;
68 
69 
70       -- code for validating the generated username
71       -- get the username
72       l_user_name := WF_ENGINE.GetItemAttrText(itemtype, itemkey,
73                                            'X_USER_NAME');
74 
75       -- loop till password clears the validations
76       l_result := FND_WEB_SEC.validate_password( l_user_name, l_password );
77       WHILE (( l_result <> 'Y') AND ( v_counter <=100) ) LOOP
78         v_counter := v_counter + 1;
79         l_password := generate_password;
80         l_result := FND_WEB_SEC.validate_password( l_user_name, l_password );
81         IF ( v_counter = 100 ) THEN
82            IF ( l_result <> 'Y' ) THEN
83               -- Throw exception as even though generated password 100 times, but
84               -- cannot pass validation criteria
85               raise_application_error (-20000, 'Could not generated password automatically which satisfies validation requirements.');
86            END IF;
87         END IF;
88       END LOOP;
89       -- end of code for validating username
90 
91      wf_engine.SetItemAttrText
92     (itemtype => itemtype,
93      itemkey  => itemkey,
94      aname   => 'X_UNENCRYPTED_PASSWORD',
95      avalue => l_password);
96 
97     end if;
98     resultout := WF_ENGINE.eng_completed || ':' || WF_ENGINE.eng_null;
99 
100     exception
101     when others then
102       Wf_Core.Context('FND_WF_STANDARD', 'SetPassword', itemtype, itemkey,
103                       actid);
104       raise;
105 end;
106 
107 --  *******************************************
108 --     Procedure ForgotPwd
109 --  *******************************************
110 /*
111 procedure ForgotPwd (c_user_name in varchar2) is
112 
113 c_error_msg              VARCHAR2(2000);
114 c_login_msg              VARCHAR2(2000);
115 email_address            VARCHAR2(240);
116 seq                      NUMBER;
117 p_name varchar2(360)     := c_user_name;
118 --p_password               VARCHAR2(30);
119 p_expire_days number     := 1;
120 rno                      VARCHAR2(30);
121 l_auth_mode              VARCHAR2(100);
122 l_user_id                NUMBER;
123 e_parameters             WF_PARAMETER_LIST_T;
124 display_name             varchar2(240);
125 notification_preference  varchar2(240);
126 language                 varchar2(30);
127 territory                varchar2(80);
128 
129 
130 BEGIN
131        SELECT user_id
132        into l_user_id
133        from fnd_user
134        where user_name = upper(c_user_name);
135 
136 BEGIN
137       SELECT 'LDAP'
138       INTO l_auth_mode
139       FROM fnd_user
140       WHERE l_user_id = icx_sec.g_user_id
141       AND upper(encrypted_user_password)='EXTERNAL';
142 
143       EXCEPTION
144       WHEN no_data_found THEN
145       l_auth_mode := 'FND';
146 END;
147 
148       IF l_auth_mode <> 'LDAP' THEN
149      WF_DIRECTORY.GetRoleInfo(upper(c_user_name), display_name, email_address, notification_preference, language, territory);
150 
151 
152 --          DBMS_RANDOM.initialize(12345);
153 --      p_password := to_char(dbms_random.random);
154 --      rno := to_number(DBMS_RANDOM.random);
155 --      p_password := 'P'||rno||'W';
156 
157 
158 --      p_password := generate_password;
159 
160       htp.img(curl => '/OA_MEDIA/FNDLOGOS.gif',
161               cattributes => 'BORDER=0');
162       htp.tableRowClose;
163       htp.tableClose;
164       htp.line;
165 
166 
167   --Raise the event
168 
169  -- WF_LOG_PKG.wf_debug_flag := TRUE;
170 
171   select ICX_TEXT_S.Nextval into seq from dual;
172 
173   WF_EVENT.AddParameterToList('X_USER_NAME', upper(p_name), e_parameters);
174 --  WF_EVENT.AddParameterToList('X_UNENCRYPTED_PASSWORD', p_password,e_parameters);
175 --  WF_EVENT.AddParameterToList('X_PASSWORD_LIFESPAN_DAYS', p_expire_days,e_parameters);
176 
177   WF_EVENT.Raise(p_event_name=>'oracle.apps.fnd.user.password.reset_requested',
178                  p_event_key=>seq, p_parameters=>e_parameters);
179 
180 --  DBMS_RANDOM.terminate;
181 
182   fnd_message.set_name('ICX','ICX_FORGOT_PASSWORD_NOTIFY');
183   c_error_msg := fnd_message.get;
184 
185   if email_address is null
186   then
187 
188   -- fnd_message.set_name('ICX','ICX_CONTACT_WEBMASTER');
189   -- c_login_msg := fnd_message.get;
190    fnd_message.set_name('ICX','ICX_EMAIL_ADDRESS_NULL_PWD');
191    c_error_msg := fnd_message.get;
192    htp.p(c_error_msg);
193 
194   else
195   htp.p(c_error_msg);
196 
197   end if;
198 
199 -- Second phase will allow re-direct to different site to change password
200 -- else if l_auth_mode = 'EXTERNAL'
201 -- then
202 -- get the value of the profile option FND_PASSWORD_EXTERNAL_SITE
203 -- create the link woth this url (redirection to the whatever the
204 -- profile options says. If null give them the standard error message below
205 -- owa_util.redirect_url(l_external_password_site);
206 
207  elsif l_auth_mode = 'EXTERNAL' then
208 
209  fnd_message.set_name('FND','PASSWORD-NOT ORACLE-MANAGED');
210  c_error_msg := fnd_message.get;
211  htp.p(c_error_msg);
212 
213  end if;
214 
215    EXCEPTION
216         when no_data_found then
217         fnd_message.set_name('ICX','ICX_ACCT_EXPIRED');
218         c_error_msg := fnd_message.get;
219         fnd_message.set_name('ICX','ICX_CONTACT_WEBMASTER');
220         c_login_msg := fnd_message.get;
221         htp.img(curl => '/OA_MEDIA/FNDLOGOS.gif',
222         cattributes => 'BORDER=0');
223         htp.tableRowClose;
224         htp.tableClose;
225         htp.line;
226         htp.p(c_error_msg);
227         htp.p(c_login_msg);
228 
229  END;
230 */
231 
232 -------------------------------------------------------------------
233 -- Name:        UpdatePassword_WF
234 -- Description: Calls FND_USER_PKG.UpdateUser
235 -------------------------------------------------------------------
236 
237 
238  Procedure UpdatePassword_WF(itemtype  in varchar2,
239                              itemkey   in varchar2,
240                              actid     in number,
241                              funcmode  in varchar2,
242                              resultout in out  NOCOPY varchar2) is
243 
244   l_user_name varchar2(360);
245   begin
246 
247     if (funcmode = 'RUN') then
248 
249       l_user_name := WF_ENGINE.GetActivityAttrText(itemtype, itemkey, actid,
250                                            'X_USER_NAME');
251       FND_USER_PKG.UpdateUser(
252            x_user_name=> l_user_name,
253            x_owner=>'CUST',
254            x_unencrypted_password=>
255              WF_ENGINE.GetActivityAttrText(itemtype, itemkey, actid,
256                                                 'X_UNENCRYPTED_PASSWORD',
257                                                 TRUE),
258            -- setting password date to null for force passwd change for user
259            x_password_date=> fnd_user_pkg.null_date,
260            /*
261            x_password_date=>
262              WF_ENGINE.GetActivityAttrDate(itemtype, itemkey, actid,
263                                                 'X_PASSWORD_DATE', TRUE),
264            */
265            x_password_accesses_left=>
266              WF_ENGINE.GetActivityAttrNumber(itemtype, itemkey, actid,
267                                                 'X_PASSWORD_ACCESSES_LEFT',
268                                                 TRUE),
269          x_password_lifespan_accesses=>
270             WF_ENGINE.GetActivityAttrNumber(itemtype, itemkey, actid,
271                                                 'X_PASSWORD_LIFESPAN_ACCESSES',
272                                                 TRUE),
273            x_password_lifespan_days=>
274              WF_ENGINE.GetActivityAttrNumber(itemtype, itemkey, actid,
275                                                 'X_PASSWORD_LIFESPAN_DAYS',
276                                                 TRUE));
277 
278 
279      -- update the password date to null. this will force the user to change
280      -- password upon first logon. refer to bug 2679640
281 
282      -- removing direct update as bug 2679640 has been fixed
283      /*
284         update fnd_user set
285         password_date = null
286         where user_name = l_user_name;
287      */
288 
289       resultout := WF_ENGINE.eng_completed || ':' || WF_ENGINE.eng_null;
290 
291     else
292       resultout := WF_ENGINE.eng_completed || ':' || WF_ENGINE.eng_null;
293 
294     end if;
295 
296   exception
297     when others then
298       Wf_Core.Context('FND_WF_STANDARD', 'UpdatePassword', itemtype, itemkey,
299                       actid);
300       raise;
301 end;
302 
303 ----------------------------------------------------------------------------
304 
305 -------------------------------------------------------------------
306 -- Name:        CreateRole
307 -- Description: Creates an adhoc role with notification preference always set
308 --              to 'MAIL'. This would ensure that the user would get an email
309 --              for all password related notifications. The name of the role
310 --              is set to FND-username
311 -------------------------------------------------------------------
312 Procedure CreateRole(itemtype  in varchar2,
313                       itemkey   in varchar2,
314                       actid     in number,
315                       funcmode  in varchar2,
316                       resultout in out NOCOPY varchar2) is
317 
318 l_user_name              varchar2(360);
319 display_name             varchar2(240);
320 notification_preference  varchar2(240);
321 language                 varchar2(30);
322 territory                varchar2(80);
323 email_address            VARCHAR2(240);
324 l_user_role              varchar2(400);
325 
326 cursor c_fnd_email is
327 select email_address
328 from fnd_user
329 where user_name = l_user_name;
330 
331 cursor c_party_email is
332 select hzp.email_address
333 from hz_parties hzp, fnd_user fu
334 where hzp.party_id = fu.customer_id
335 and fu.user_name = l_user_name;
336 
337 begin
338 
339   if (funcmode = 'RUN') then
340    l_user_name := upper(WF_ENGINE.GetItemAttrText(itemtype, itemkey,
341                                            'X_USER_NAME'));
342    l_user_role := 'FNDPWD_'||itemkey||l_user_name;
343 
344    -- check to see if the user has notification pref set to mail. if not
345   -- create the role.
346 
347        WF_DIRECTORY.GetRoleInfo(l_user_name,
348                                 display_name,
349                                 email_address,
350                                 notification_preference,
351                                 language, territory);
352       if (notification_preference like 'MAIL%'
353             and email_address is not NULL) then
354              l_user_role := l_user_name;
355       else
356          -- if email address is null get it from fnd
357          if email_address is NULL then
358             for k in c_fnd_email loop
359               email_address := k.email_address;
360             end loop;
361          end if;
362 
363          -- if email address is null get it from party
364          if email_address is NULL then
365             for k in c_party_email loop
366               email_address := k.email_address;
367             end loop;
368          end if;
369 
370          WF_DIRECTORY.CreateAdHocRole  (role_name => l_user_role,
371             role_display_name =>  l_user_role,
372             language          => language,
373             territory => territory,
374             role_users => null,
375             email_address => email_address);
376       end if;
377 
378 
379 
380 
381    -- set the role in fnd_user workflow to the new role
382 
383    wf_engine.SetItemAttrText
384     (itemtype => itemtype,
385      itemkey  => itemkey,
386      aname   => 'X_USER_ROLE',
387      avalue => l_user_role);
388 
389   end if;
390   resultout := WF_ENGINE.eng_completed || ':' || WF_ENGINE.eng_null;
391   exception
392     when others then
393       Wf_Core.Context('FND_WF_STANDARD', 'CreateRole', itemtype, itemkey,
394                       actid);
395       raise;
396 end CreateRole;
397 
398 procedure ForgotPwd (p_user_name in varchar2,
399                      x_return_status out  NOCOPY varchar2,
400                      x_message_data  out  NOCOPY varchar2) is
401 l_message_name varchar2(2000);
402 begin
403    /* Commented out by pseo to support passing back the message-name
404      forgotPwd(p_user_name => p_user_name,
405              p_user_appr_msg_name => null,
406              p_pwd_reset_msg_name => null,
407              x_return_Status => x_return_status,
408              x_message_Data  => x_message_Data);
409    */
410    forgotPwd(p_user_name => p_user_name,
411              p_user_appr_msg_name => null,
412              p_pwd_reset_msg_name => null,
413              x_return_Status => x_return_status,
414              x_message_name => l_message_name,
415              x_message_data  => x_message_data);
416 end;
417 
418 procedure ForgotPwd (p_user_name in varchar2,
419                      x_return_status out  NOCOPY varchar2,
420                      x_message_name  out  NOCOPY varchar2,
421                      x_message_data  out  NOCOPY varchar2) is
422 begin
423    forgotPwd(p_user_name => p_user_name,
424              p_user_appr_msg_name => null,
425              p_pwd_reset_msg_name => null,
426              x_return_Status => x_return_status,
427              x_message_name => x_message_name,
428              x_message_data  => x_message_data);
429 end;
430 
431 procedure ForgotPwd (p_user_name in varchar2,
432                      p_user_appr_msg_name in varchar2,
433                      p_pwd_reset_msg_name in varchar2,
434                      x_return_status out  NOCOPY varchar2,
435                      x_message_data  out  NOCOPY varchar2) is
436 l_message_name varchar2(2000);
437 begin
438    forgotPwd(p_user_name => p_user_name,
439              p_user_appr_msg_name => null,
440              p_pwd_reset_msg_name => null,
441              x_return_Status => x_return_status,
442              x_message_name => l_message_name,
443              x_message_data  => x_message_data);
444 end;
445 
446 procedure ForgotPwd (p_user_name in varchar2,
447                      p_user_appr_msg_name in varchar2,
448                      p_pwd_reset_msg_name in varchar2,
449                      x_return_status out  NOCOPY varchar2,
450                      x_message_name out  NOCOPY varchar2,
451                      x_message_data  out  NOCOPY varchar2) is
452 
453 
454 email_address            VARCHAR2(240);
455 seq                      NUMBER;
456 l_auth_mode              VARCHAR2(100);
457 l_user_id                NUMBER;
458 display_name             varchar2(240);
459 notification_preference  varchar2(240);
460 language                 varchar2(30);
461 territory                varchar2(80);
462 p_name                   varchar2(300) := upper(p_user_name);
463 l_fnd_email_address      varchar2(240);
464 
465 cursor C_active_wf_exists is
466 select 'X'
467 from wf_items wfi, wf_item_attribute_values wfa
468 where wfi.item_type = wfa.item_type
469 and wfi.item_key = wfa.item_key
470 and wfi.item_type = 'JTFFPWD'
471 and wfi.end_date is NULL
472 and wfa.name = 'X_USER_NAME'
473 and wfa.text_value = p_name;
474 
475 cursor c_party_email is
476 select hzp.email_address
477 from hz_parties hzp, fnd_user fu
478 where hzp.party_id = fu.customer_id
479 and fu.user_name = p_name;
480 
481 begin
482   -- initialize the return status
483   x_return_status := FND_API.G_RET_STS_ERROR;
484 
485  -- validate user name
486   if p_user_name is NULL then
487      fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_NULL_USER');
488 	 x_message_name := 'JTA_UM_FORGOT_PWD_NULL_USER';
489      x_message_data := fnd_message.get;
490      return;
491   end if;
492 /*
493  -- validate active wf
494   for j in C_active_wf_exists loop
495      fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_WF_EXISTS');
496      x_message_data := fnd_message.get;
497      return;
498   end loop;
499 */
500 
501   SELECT user_id,
502          decode(upper(encrypted_user_password),'EXTERNAL','EXTERNAL','FND'),
503          email_address
504   into l_user_id, l_auth_mode, l_fnd_email_address
505   from fnd_user
506   where user_name = p_name
507   and start_date <= sysdate
508   and nvl(end_date, sysdate + 1) > sysdate;
509 
510   -- validate required fields
511   /*
512 	if l_user_id = 1004139 then
513        fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_EXTERNAL');
514 	   --x_message_data := fnd_message.get_number( 690, 'JTA_UM_FORGOT_PWD_NULL_EMAIL' );
515 	   x_message_name := 'JTA_UM_FORGOT_PWD_EXTERNAL';
516        x_message_data := fnd_message.get;
517 	   return;
518     end if;
519   */
520   IF FND_SSO_Manager.isPasswordChangeable( p_name ) THEN
521      WF_DIRECTORY.GetRoleInfo(p_name, display_name,
522                  email_address, notification_preference, language, territory);
523 
524 
525      if email_address is null then
526        -- get the email from fnd_user in case hr email is null
527        email_address := l_fnd_email_address;
528 
529        if email_address is null then
530        -- if email is still null then get it from tca
531        -- check if there is a valid party email
532          for k in c_party_email loop
533            email_address := k.email_address;
534          end loop;
535        end if;
536      end if;
537 
538      if email_address is not null then
539        select JTF_UM_PSW_WF_S.Nextval into seq from dual;
540 
541       -- start the workflow that will send the notification and reset
542       -- the password
543 
544         wf_engine.CreateProcess(itemtype => 'JTFFPWD',
545          itemkey => seq,
546          process => 'RESETPASSWD');
547         wf_engine.SetItemAttrText(itemtype => 'JTFFPWD',
548          itemkey => seq,
549          aname => 'X_USER_NAME',
550          avalue => p_name);
551 
552          if p_user_appr_msg_name is not null then
553             wf_engine.SetItemAttrText(itemtype => 'JTFFPWD',
554             itemkey => seq,
555             aname => 'APPR_MESSAGE',
556             avalue => p_user_appr_msg_name);
557          end if;
558 
559           if p_pwd_reset_msg_name is not null then
560             wf_engine.SetItemAttrText(itemtype => 'JTFFPWD',
561             itemkey => seq,
562             aname => 'CONFIRM_MSG',
563             avalue => p_pwd_reset_msg_name);
564          end if;
565 
566         wf_engine.StartProcess(itemtype => 'JTFFPWD',
567          itemkey => seq);
568 
569 
570        fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_NOTIFY');
571 	   x_message_name := 'JTA_UM_FORGOT_PWD_NOTIFY';
572        x_message_data := fnd_message.get;
573        x_return_status := FND_API.G_RET_STS_SUCCESS;
574 
575     else --email address is null
576 
577        fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_NULL_EMAIL');
578 	   --x_message_data := fnd_message.get_number( 690, 'JTA_UM_FORGOT_PWD_NULL_EMAIL' );
579 	   x_message_name := 'JTA_UM_FORGOT_PWD_NULL_EMAIL';
580        x_message_data := fnd_message.get;
581 
582     end if;
583 
584  else -- cannot change password for this user
585 
586 /*
587 -- Second phase will allow re-direct to different site to change password
588 -- else if l_auth_mode = 'EXTERNAL'
589 -- then
590 -- get the value of the profile option FND_PASSWORD_EXTERNAL_SITE
591 -- create the link woth this url (redirection to the whatever the
592 -- profile options says. If null give them the standard error message below
593 -- owa_util.redirect_url(l_external_password_site);th_mode = 'EXTERNAL' then
594 */
595 
596 
597    fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_EXTERNAL');
598    x_message_name := 'JTA_UM_FORGOT_PWD_EXTERNAL';
599    x_message_data := fnd_message.get;
600 
601  end if;
602 
603 
604    EXCEPTION
605         when no_data_found then
606         fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_INVALID_ACCT');
607 		x_message_name := 'JTA_UM_FORGOT_PWD_INVALID_ACCT';
608         x_message_data := fnd_message.get;
609 
610  END;
611 
612 /*
613 -- Commented out by pseo to support passing back the message-name
614 procedure ForgotPwd (p_user_name in varchar2,
615                      p_user_appr_msg_name in varchar2,
616                      p_pwd_reset_msg_name in varchar2,
617                      x_return_status out  NOCOPY varchar2,
618                      x_message_data  out  NOCOPY varchar2) is
619 
620 
621 email_address            VARCHAR2(240);
622 seq                      NUMBER;
623 l_auth_mode              VARCHAR2(100);
624 l_user_id                NUMBER;
625 display_name             varchar2(240);
626 notification_preference  varchar2(240);
627 language                 varchar2(30);
628 territory                varchar2(80);
629 p_name                   varchar2(300) := upper(p_user_name);
630 l_fnd_email_address      varchar2(240);
631 
632 cursor C_active_wf_exists is
633 select 'X'
634 from wf_items wfi, wf_item_attribute_values wfa
635 where wfi.item_type = wfa.item_type
636 and wfi.item_key = wfa.item_key
637 and wfi.item_type = 'JTFFPWD'
638 and wfi.end_date is NULL
639 and wfa.name = 'X_USER_NAME'
640 and wfa.text_value = p_name;
641 
642 cursor c_party_email is
643 select hzp.email_address
644 from hz_parties hzp, fnd_user fu
645 where hzp.party_id = fu.customer_id
646 and fu.user_name = p_name;
647 
648 begin
649   -- initialize the return status
650   x_return_status := FND_API.G_RET_STS_ERROR;
651 
652   -- validate required fields
653 
654  -- validate user name
655   if p_user_name is NULL then
656      fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_NULL_USER');
657      x_message_data := fnd_message.get;
658      return;
659   end if;
660 
661   SELECT user_id,
662          decode(upper(encrypted_user_password),'EXTERNAL','EXTERNAL','FND'),
663          email_address
664   into l_user_id, l_auth_mode, l_fnd_email_address
665   from fnd_user
666   where user_name = p_name
667   and start_date <= sysdate
668   and nvl(end_date, sysdate + 1) > sysdate;
669 
670   IF FND_SSO_Manager.isPasswordChangeable( p_name ) THEN
671      WF_DIRECTORY.GetRoleInfo(p_name, display_name,
672                  email_address, notification_preference, language, territory);
673 
674      if email_address is null then
675        -- get the email from fnd_user in case hr email is null
676        email_address := l_fnd_email_address;
677 
678        if email_address is null then
679        -- if email is still null then get it from tca
680        -- check if there is a valid party email
681          for k in c_party_email loop
682            email_address := k.email_address;
683          end loop;
684        end if;
685      end if;
686 
687      if email_address is not null then
688        select JTF_UM_PSW_WF_S.Nextval into seq from dual;
689 
690       -- start the workflow that will send the notification and reset
691       -- the password
692 
693         wf_engine.CreateProcess(itemtype => 'JTFFPWD',
694          itemkey => seq,
695          process => 'RESETPASSWD');
696         wf_engine.SetItemAttrText(itemtype => 'JTFFPWD',
697          itemkey => seq,
698          aname => 'X_USER_NAME',
699          avalue => p_name);
700 
701          if p_user_appr_msg_name is not null then
702             wf_engine.SetItemAttrText(itemtype => 'JTFFPWD',
703             itemkey => seq,
704             aname => 'APPR_MESSAGE',
705             avalue => p_user_appr_msg_name);
706          end if;
707 
708           if p_pwd_reset_msg_name is not null then
709             wf_engine.SetItemAttrText(itemtype => 'JTFFPWD',
710             itemkey => seq,
711             aname => 'CONFIRM_MSG',
712             avalue => p_pwd_reset_msg_name);
713          end if;
714 
715         wf_engine.StartProcess(itemtype => 'JTFFPWD',
716          itemkey => seq);
717 
718 
719        fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_NOTIFY');
720        x_message_data := fnd_message.get;
721        x_return_status := FND_API.G_RET_STS_SUCCESS;
722 
723 
724     else --email address is null
725 
726        fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_NULL_EMAIL');
727         x_message_data := fnd_message.get;
728 
729     end if;
730 
731  else -- cannot change password for this user
732 
733    fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_EXTERNAL');
734    x_message_data := fnd_message.get;
735 
736  end if;
737 
738 
739    EXCEPTION
740         when no_data_found then
741         fnd_message.set_name('JTF','JTA_UM_FORGOT_PWD_INVALID_ACCT');
742         x_message_data := fnd_message.get;
743 
744  END;
745 
746 */
747 
748 end JTF_UM_FORGOT_PASSWD;