1 2 Previous Next 16 Replies Latest reply: Aug 3, 2011 12:34 AM by 879856 RSS

    login screen

    ali
      how to create our own login screen



      i want to create login screen in developer 10g
        • 1. Re: login screen
          Sarah
          hi

          step1

          create pre-form trigger.
          BEGIN
          :global.quit := 'FALSE';
          :global.v_attempt := 0;
          
          
          END;
          sarah
          • 2. Re: login screen
            Sarah
            step2

            when-windows-activated trigger.
            declare
                 fm_id formmodule;
            begin
                 fm_id :=find_form(:system.current_form);
                 set_form_property(fm_id,defer_required_enforcement,property_true);
                 set_window_property(forms_mdi_window,window_state,maximize);
                 set_window_property(forms_mdi_window,title,'Login');
                 set_window_property('login_window',window_state,maximize);
                 set_window_property('login_window',title,'Login');
            
                 end;
            sarah
            • 3. Re: login screen
              ali
              ok done nw what ????
              • 4. Re: login screen
                Sarah
                hi
                step3

                on-logon trigger.
                logon(get_application_property(USERNAME), 
                     get_application_property(PASSWORD)||'@'||get_application_property(CONNECT_STRING), FALSE);
                if not form_success then
                 :global.bad := 1;
                 raise form_trigger_failure;
                end if;
                sarah
                • 5. Re: login screen
                  Sarah
                  step-4.

                  when-button-pressed trigger for login.
                  if :LOGIN_BLOCK.USERNAME is null then
                   message('User must be entered !');
                   go_item('LOGIN_BLOCK.USERNAME');
                   return;
                  end if;
                  if :LOGIN_BLOCK.PASS_WORD is null then
                   MESSAGE('Password must be entered !');
                   go_item('LOGIN_BLOCK.PASS_WORD');
                   return;
                  end if;
                  set_application_property(CURSOR_STYLE,'normal');
                  :global.bad  := 0;
                  if :LOGIN_BLOCK.CONNECT_STRING is null then
                   logon(:LOGIN_BLOCK.USERNAME,:LOGIN_BLOCK.PASS_WORD, FALSE);
                  else
                   logon(:LOGIN_BLOCK.USERNAME,:LOGIN_BLOCK.PASS_WORD||'@'||:LOGIN_BLOCK.CONNECT_STRING, FALSE);
                  end if;
                  if :global.bad = 0 and form_success then
                  set_application_property(CURSOR_STYLE,'normal');
                   open_form('TREE',no_hide,no_replace);
                   exit_form;
                  ELSE
                   :global.v_attempt  := :global.v_attempt  + 3;
                  set_application_property(CURSOR_STYLE,'normal');
                   if :global.v_attempt  < 2 then
                     MESSAGE('Username/Password was invalid. Please re-enter !');
                     go_item('LOGIN_BLOCK.USERNAME');
                   else
                     MESSAGE('Invalid Login Attempts. Account Locked');
                     exit_form(no_validate);
                   end if;
                  
                  end if;
                  sarah
                  • 6. Re: login screen
                    ali
                    where to place this when window closed trigger at form level i implemented
                    • 7. Re: login screen
                      Sarah
                      hi

                      step-5

                      create cancel(Exit) button and alert with the following code.
                      declare
                           
                           alert_close number;
                      begin
                           alert_close := show_alert('alert_close');
                           if alert_close = alert_button1 then
                                
                                exit_form;
                           
                                end if;
                                
                                end;
                      sarah
                      • 8. Re: login screen
                        Sarah
                        yeah form level


                        sarah
                        • 9. Re: login screen
                          Sarah
                          hi

                          step-6

                          create procedure with the following code.
                          PROCEDURE Log_on IS
                          BEGIN
                           :global.quit := 'TRUE';
                           exit_form(no_validate);
                          END;
                          sarah
                          • 10. Re: login screen
                            732795
                            hello sarah,

                            could you please a little document your code, suppose why you use :global.bad variable ? why initialize it to 0 etc.
                            it would help a lot.

                            Regards
                            • 11. Re: login screen
                              732795
                              and besides , i think there is mistake in your code

                              :global.v_attempt := :global.v_attempt + 3;

                              it should be :global.v_attempt := :global.v_attempt + 1;

                              and

                              if :global.v_attempt < 2 then

                              it should be if :global.v_attempt < =3 then

                              Regards
                              • 12. Re: login screen
                                Sarah
                                hi


                                its depend on use even we can do something like this too.
                                     :global.item >= 3
                                sarah
                                • 13. Re: login screen
                                  732795
                                  OFCOURSE,

                                  what is the benefit of the :global.bad variable?

                                  THanks
                                  • 14. Re: login screen
                                    Sarah
                                    hi


                                    here is an example:
                                    declare
                                    l_pw_expired varchar2(1) default 'N';
                                    
                                    begin
                                    
                                    default_value ( 0, 'global.bad' );
                                    
                                    if
                                         :LOGIN_BLOCK.USERNAME is null OR :LOGIN_BLOCK.PASS_WORD is null
                                    then
                                      message( 'Please enter username and password to login.' );
                                      message( ' ' );
                                      go_item( 'LOGIN_BLOCK.USERNAME' );
                                      return;
                                    end if;
                                    
                                    :global.bad := to_number ( :global.bad ) + 1;
                                    
                                    if
                                         :LOGIN_BLOCK.CONNECT_STRING is null
                                    then
                                      logon( :LOGIN_BLOCK.USERNAME, :LOGIN_BLOCK.PASS_WORD, FALSE );
                                    else
                                      logon( :LOGIN_BLOCK.USERNAME, :LOGIN_BLOCK.PASS_WORD ||'@'|| :LOGIN_BLOCK.CONNECT_STRING, FALSE );
                                    end if;
                                    
                                    if
                                         NOT form_success
                                    then
                                      message ( dbms_error_text );
                                      message ( ' ' );
                                      if
                                           :global.bad >= 3
                                      then
                                        clear_message;
                                        message ( 'Maximum login attempts exceeded. The application will be closed.' );
                                        exit_form ( no_validate );
                                      end if;
                                      :login_block.pass_word := null;
                                      go_item ( 'login_block.pass_word' );
                                      raise form_trigger_failure;
                                    end if;
                                    
                                    for l_rec in ( select 'Y' i_expired
                                                   from  qi_user
                                                   where user_id = user
                                                   and   trunc ( sysdate ) - trunc ( pw_change ) >= 30
                                                   and   rownum = 1 ) loop
                                      l_pw_expired := l_rec.i_expired;
                                    end loop;   
                                      
                                    if
                                      l_pw_expired = 'Y'
                                    then
                                      message ( 'Your password has been expired. Please click OK to change your password.' );
                                      call_form ( 'QI107', hide, no_replace );
                                    end if;
                                    
                                    new_form ( 'QI100' );
                                    
                                    end;
                                    Note:- If u have problem please post new thread for u.


                                    sarah
                                    1 2 Previous Next