Jump to content

Title Application


picyka

Recommended Posts

13 minutes ago, Sherzod said:

Can you please explain in more details?

When I set the title on the login screen, after retrieving the user, it works fine, but there are users who have automatic login, passing a hash by the URL as a parameter, this case does not work

 

procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean);
var
  aApp: TUniGUIApplication;
  lCliente: String;
begin
  Handled := False;
  aApp := (Sender as TUniGUISession).UniApplication;
  lCliente := aApp.Parameters.Values['u'];

  if not lCliente.IsEmpty then
  begin
    var lClientAuth := Self.ClientApiAuth;
    try
      try
        Self.TOKEN_API := lClientAuth.Service<IServiceLogin>.ValidaLoginHash(UpperCase(lCliente));
        Handled := (Self.TOKEN_API <> '');

        if Handled then
        begin
          UniMainModule.SetUserLogado(Self.GetClientApiApp.Service<IServiceUsuario>.FindUsuarioByHash(UpperCase(lCliente)));

          if Self.UserActive.Empresa <> nil then
            Self.Title := 'Assistência 24 HS - ' + UniMainModule.UserActive.Empresa.NomeFantasia;

          UniSession.UserString := UniMainModule.UserActive.Nome + ' - Mobile';
        end;

      except
        Handled := False;
      end;
    finally
      lClientAuth.Free;
    end;
  end;
end;

 

Link to comment
Share on other sites

2 minutes ago, picyka said:

n this case, it opens a form of the mobile, is that why?

I understand the general condition is true:

4 hours ago, picyka said:
        Handled := (Self.TOKEN_API <> '');

        if Handled then

 

But I'm not sure if this condition is true:

4 hours ago, picyka said:
if Self.UserActive.Empresa <> nil then

 

Link to comment
Share on other sites

1 minuto atrás, Sherzod disse:

Eu entendo que a condição geral é verdadeira:

Mas não sei se essa condição é verdadeira:

 

Look at the attached images, I debugged it here, the condition is true, if you want you can access it here...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...