3 Replies Latest reply: May 22, 2008 10:47 PM by 623630 RSS

    Login Screen Using Forms 6i

    623630
      Hi All!

      I coded that and it is working properly.

      First (after creation of the canvas), you can write the following in a procedure which is called in When-New-Form-Instance-Trigger:

      PROCEDURE form_initialize IS
      usern VARCHAR2(30) := GET_APPLICATION_PROPERTY(USERNAME);
      passw VARCHAR2(30) := GET_APPLICATION_PROPERTY(PASSWORD);
      connect_string CONSTANT VARCHAR2(30) := 'DATABASE1';
      BEGIN
      DEFAULT_VALUE(null, 'global.username');
      DEFAULT_VALUE(connect_string, 'global.database');

      :global.username := usern;
      :dta_logon.user_name := :global.username;
      :dta_logon.password := passw;
      END;

      Then you can code the following in a button's When-Button-Pressed-Trigger (e.g. the button must be pressed to logon):

      BEGIN
      :global.first_login := 'FALSE';

      LOGON(:dta_logon.user_name,
      :dta_logon.password||'@'||:global.database,FALSE);
      END;

      Also you will need an On-Logon-Trigger at Formslevel:

      begin
      default_value('TRUE', 'global.first_login');

      if :global.first_login = 'FALSE'
      then
      LOGON(:dta_logon.user_name, :dta_logon.password||'@'||:global.database, FALSE);

      if form_success
      then
      e.g. call_form(...)

      logout;
      else
      -- Password expired.
      if dbms_error_code = -28001
      then
      LOGON(:dta_logon.user_name, :dta_logon.password||'@'||:global.database, TRUE);
      else
      LOGON(:dta_logon.user_name, :dta_logon.password||'@'||:global.database, FALSE);
      end if;

      if form_success
      then
      e.g. call_form(...)

      logout;
      else
      if dbms_error_code = -1017
      then
      message('Password or Username incorrect !');
      elsif dbms_error_code = -28000
      then
      message('User is locked !');
      end if;
      end if;
      end if;
      end;

      Finally, if you want to leave the form, you can code:

      PROCEDURE form_leave (status BOOLEAN DEFAULT TRUE) IS
      BEGIN
      IF status
      THEN
      :global.logon_ok := 'TRUE';
      - logout;
      ELSE
      :global.logon_ok := 'FALSE';
      END IF;
      EXIT_FORM;
      END;

      But my question is that, dbms_error_code = -28000 and other errors which relates to dbms_error_code does not show the result.
      Suppose when i give wrong user name and password and other information then it does not generate error. Please help me...