Press "Enter" to skip to content

Creating Custom Login Screen In Oracle Forms 10g

Below is the example plsql unit to validate login credentials and after successful validation open a new form by passing some parameters to it, in Oracle forms 10g.
Create a form for custom login. Create text items for username and password etc. and a login button. When user click on that login button call this plsql routine.

    vPassword fox_user.password%type; — get a password field type from your user master table
    plid paramlist;
— check if username is null
if :appstart.usn is null then
    error_message(‘User name must be entered.’);
    raise Form_Trigger_Failure;
end if;
— check if password is null
if :appstart.psw is null then
    error_message(‘Password must be entered.’);
    raise Form_Trigger_Failure;
end if;
select password into vpassword
      from fox_user
      where rtrim(userid) = rtrim(:appstart.usn);
— decrypt password using your own encrypt / decrypt method.
— below mentioned decrypt is a program unit i used
if :appstart.psw != decrypt(vpassword) then
     error_message(‘Invalid Password for the user. Logon Denied!’);
     raise form_trigger_Failure;
end if;
  — if valid username and password then create parameter list to pass the calling form
    plid := get_parameter_list(‘formdata’);
    if Not id_null(plid) then
    end if;
    plid := Create_Parameter_list(‘formdata’);
    Add_parameter(plid, ‘userid’, text_parameter, :appstart.usn);
new_form(‘main’, full_rollback, no_query_only, plid);  
     when no_data_found then
        error_message(‘Invalid Userid. Please enter valid userid and password. Logon Denied!’);
     when too_many_rows then
        error_message(‘Internal error…’);
     when others then