Jump to content

isosrl

uniGUI Subscriber
  • Posts

    27
  • Joined

  • Last visited

Posts posted by isosrl

  1. Hi,

    I use Chrome on Android tablet to test my webapp made with unigui mobile. I add the shortcut to desktop so when I tap it starts like an app...but as soon I type on a edit field (even if it is not a password field) chrome show in the top the warning that remain in all pages making error in layout forms...

    I know that I could buy a ssl certificate, but there is another way to avoid that ?

     

    Thanks,

    Francesco

    Screenshot_20190125-180309.jpg

  2. Hi,

    no solution for SAML 2.0 but in my case client also has OAuth2 authentication...

    So I made a half of a real good solution...

    In the LoginForm the user click on a button that redirect to sign-on

    Note: XXX is the name of the client

    procedure TUniLoginForm1.btNextXXXClick(Sender: TObject);
    var
        _XXXurl, _state: string;
    begin
    
      //redirect login
      _XXXurl:='https://login-dev.XXX.com/adfs/oauth2/authorize?response_type=code'+
                '&resource=XXXClientPortal'+
                '&client_id=a123-b456-c789'+
                '&redirect_uri=http://dev.test.it:8077/?callback=XXX';
    
      //add an encrypted string in parameter state that will returned back without modification
      _state:='&state='+XEncrypt(edCodCliente.Text+'|'+edCodUtente.Text+'|'+DateTimeToStr(NOW)+'|'+UniSession.SessionId);
    
      _XXXurl:=_XXXurl+_state;
      UniSession.UrlRedirect(_XXXurl);
    end;

    In MainModule

    procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean);
    var
        _callback, _state: string;
    
        _CodUtente, _DataOra, _SessionID: string;
    begin
    
      if (not _FlStatoAutoLogin) then
      begin
        //check if arrived from callback
        _callback:=UniSession.UniApplication.Parameters.Values['callback'];
        _state:=UniSession.UniApplication.Parameters.Values['state'];
        if (_callback='XXX') and (_state<>'') then
        begin
            _state:=XDecrypt(_state);
    
            _CodClient:=GetStrPosiz(_state, '|', 1);
            _CodUtenteXXX:=GetStrPosiz(_state, '|', 2);
            _DataOra:=GetStrPosiz(_state, '|', 3);
            _SessionID:=GetStrPosiz(_state, '|', 4);
    
            if (MinutesBetween(StrToDateTime(_DataOra), NOW)<=5)
                and ChkExistSessionID(_SessionID) then
            begin
                _FlStatoAutoLogin:=True;
                Handled:=True;
            end;
        end;
      end;                                       
    end;
                                            
    function TUniMainModule.ChkExistSessionID(SessionID: string): boolean;
    var
        _path: string;
    begin
        //look in files if exists a session with specific ID
        _path:=UniServerModule.CacheFolderPath+'cache\'+
                            ReplaceText(ExtractFileName(Application.ExeName), '.exe', '_exe')+'\'+
                            SessionID;
        Result:=(DirectoryExists(_path));
    end;
                                            

    To exit and get again loginform, in Main.pas

    procedure TMainForm.UniFormClose(Sender: TObject; var Action: TCloseAction);
    begin
        if UniMainModule._FlStatoAutoLogin then
        begin
            UniSession.UrlRedirect('?');
            Action:=caNone;
        end;
    end;

     

    The above it's just to authorize access to my unigui webapp...

     

    • Like 1
  3. Hi Farshad,

     

    ADO components, Indy IMAP, UniThreadTimer reside in ServerModule since I need to pool IMAP server and when I found new emails they are copied into SQL database for later use.

    Main form is used only for SQL database and IMAP configuration, protected by the Login form.

     

    Attached you can find the project.

     

    It is not necessary to configure SQL and IMAP access, since if they are empty the project runs but does nothing.

    Eventually password for login form is admin.

    The project will pool the folder INBOX/RichiesteArticoli of the imap user.

    GetMailRichiesteArticoli.zip

  4. Hi,

    I have a project (unigui 0.99.90.1291) with ADO components and Indy IMAP component that when compiled as Windows StandAlone works correctly; when I compile it as Windows Service and start the service it stops; in log a read the error "CoInitialize has not been called".

     

    I have set ServerModule->AutoCoInitializa to True.

     

    I run the service on my pc but the sql server is on another pc, so I try to change in Windows Service the account from "Local Service" to "Network Service", still the problem.

     

     

    Any ideas ?

     

    Thanks,

    Francesco

     

     

  5. Hi,

    I need to refresh data of a TUniDBGrid each X minutes, so I use a TUniThreadTimer and in the OnTimer event I close and Open the query but the new data are not refreshed in the grid.

    I did also a TUniDBGrid.Refresh and/or MainForm.Refresh with no success...

    But if I put a button and click on it the grid is refreshed...

    What I miss ?

     

    Thanks,

    Francesco

×
×
  • Create New...