Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Custom User Login Dialog

dgirard
2021-03-01
2021-03-05
  • dgirard - 2021-03-01

    Hi everyone

    Is it possible to create a custom user login frame with simple text fields for username and password and a login button that executes the search for a matching user name and password? Basically I want to use the existing backend of the stock user management but not the front end graphics. The reason for this is that I am having performance issues using the on-screen keyboard that is built into the front end of the stock user management. I don't have any performance issues if I use a simple text box and pop-up keyboard. It's strange, but this should help get rid of the lag I am experiencing.

    Thanks in advance

     

    Last edit: dgirard 2021-03-01
  • m.prestel - 2021-03-02

    hello @dgirad,

    there are a few things you can do.
    Switch to default text input keyboard (see https://help.codesys.com/webapp/_visu_obj_webvisu;product=core_visualization;version=3.5.16.0 section Default text input)
    In every CODESYS installation a Projects\Visu\Dialogs\VisuDialogs.library. You can edit this library to adjust the dialog to your needs and install it
    * Report the performance issue with steps to repeat in the store

    Best regards,
    Marcel

     
  • dgirard - 2021-03-02

    Hi @m.prestel

    The performance issue is hardware related which only occurs on the TargetVisu and the manufacturer has acknowledged it. The login dialog works very well on Webvisu. With that being said, I'm not sure you'll be able to replicate the issue on your end.

    My idea is to simply modify the stock user management dialog to improve the performance on the target visu. I want to create a simple frame with a text box for username and another for password. Once those two are entered, the user will press the login button and close the dialog. This will be very similar to the stock login dialog, except I don't want all the stuff running in the background which I believe is causing the severe lag.

    Any recommendations on how to proceed?

    When using the stock user login dialog, which command is executed if the OK button is pressed? And where is the username and password sent to for checking? This is what I can't seem to figure out. See picture attached.

     
  • dgirard - 2021-03-02

    @m.prestel

    I've been playing with the custom user management library provided by 3S (C:\Program Files (x86)\3S CODESYS\CODESYS\Projects\Visu\Dialogs\VisuUserMgmtDialogs.library), however it doesn't seem like this user management system is linked to the stock one in Codesys. Can you shine a light on this for me please? See picture attached.

    Thank you

     
  • m.prestel - 2021-03-03

    hello @dgirad,

    there are a lot of optimizations in place if a modal dialog is opened (e.g. the background visualization gets updated less).

    If your OEM confirmed the issue, I would expect he raises an issue for CODESYS.

    The visualizations in VisuUserMgmtDialogs are the exact same visualizations you get by using the stock dialogs.

    Best regards,
    Marcel

     
  • dgirard - 2021-03-03

    Thanks for the feedback.

    To simplify things: What can I do to make the text boxes in the attached Capture take in the username and password? How can I make the Login button initiate the login code?

    For example: VisuUserManagement.g_VisuLoginProviderManager.m_arrLoginProvider[iIndexLoginProvider].stUserName

    ^^This doesn't seem to work.

    Any ideas?

     
  • Morberis

    Morberis - 2021-03-03

    I can say that the same behavior is observed on both Eaton's XV100 and XV300 machines with respect to the slow login screen behaviour. The XV100 is the worst of the 2, being much older hardware, taking several seconds per button press using the login dialogue's on-screen keyboard. It's a problem they've acknowledged before but one without a solution. It can even be a problem when using a webvisu provided by an XV100. All they recommend is using their suggested visualization style or switching to using 1 of their visualization software products like Visual Designer or Galileo. It is also a hardware issue from what tech support has told me. I don't experience the same problems when using either of their products.

    It would be nice to have an example project on the Codesys Examples page that demonstrates what dgirard would like to do. Also which demonstrates how to login a user programmaticly. Like if they use an RFID card or use a locked switch to login.

    I say that but here is a post with a project demonstrating changing the logged in user via IEC code. It's just not as easy for someone to find. It does seem to be a question that pops up occasionally. You might find something that helps you in there @dgirard

     
    πŸ‘
    1

    Last edit: Morberis 2021-03-03
  • dgirard - 2021-03-03

    Thanks @Morberis, the example on the pi page was very helpful and has me headed in the right direction.

    One question for yous: the code snip below will log me in automatically, but regardless of which visualization I log in from, it will always log me into the TargetVisu. Do you know what is missing so that it will log me into the visualization from which the login button was pressed? I'm assuming it has to do with detecting the press of the button and matching it to the proper pclient?

    LoginButton_R_TRIG(clk := LoginButton);
    BooleanTest := TRUE;
    IF BooleanTest THEN
            VisuElems.g_ClientManager.BeginIteration(); 
            pClient := VisuElems.g_ClientManager.GetNextClient(); 
    
            WHILE pClient <> VisuElems.NULL DO 
                IF (pClient^.GlobalData.CurrentUserGroupId <> 3) THEN 
                    arr[0] := 3; 
                    arr[1] := 3; 
                    IF LoginButton_R_TRIG.Q HEN
                        VisuUserManagement.g_VisuUserMgmt2.LoginToUserGroups(pClient, ADR(arr), 3, STRING_TO_WSTRING(username), "Operator"); 
                    END_IF  
                END_IF 
    
            pClient := VisuElems.g_ClientManager.GetNextClient();
    
            END_WHILE
    END_IF
    

    Thanks in advance!

     
  • Morberis

    Morberis - 2021-03-04

    Hmm so if you login in 1 client it logs in on all the visualization clients? Do you get the same behavior if you use the normal login dialogues? And are all the visualization clients locked into viewing the same pages or can they all look at a different page?

    I remember something about this but I'm sorry I can't seem to find any good info.

    I did find this page, Using Events of the User Management (Login/Logout)

    You might find an answer in the Client Independent Visualization Switching example project.

    I also found this post which is of dubious help here.

    Someone else has asked this before. I'm sorry I can't seem to find anything in the time I have available though.

     

    Last edit: Morberis 2021-03-04
  • dgirard - 2021-03-04

    Thanks for the resources!

    No, it only logs me into the TargetVisu, none of my Webvisu will get logged in even if I am pressing the login button on the Webvisu Visualization.

    I need a way to detect which client has pressed the button and log in that specific client. Any idea how to achieve this?

     
  • eschwellinger

    eschwellinger - 2021-03-04

    which version are you using?

     
  • dgirard - 2021-03-04

    V3.5 SP15

     
  • eschwellinger

    eschwellinger - 2021-03-04

    maybe worth to check with current version.. if possible.

     
  • m.prestel - 2021-03-05

    The problem is that you are iterating over all clients with your ST Code and log in every client.

    First of all you should never iterate over all clients with this function outside of the visu task. If you have to iterate, use VisuUtils.

    Secondly, you can get the current client in the mouse click action.
    Call a function in your input action and include the argument pClientData.

    Best regards,
    Marcel

     
  • dgirard - 2021-03-05

    @m.prestel thank you for the info.

    I have got it mostly working now. The only thing remaining is retrieving the FullUserName from the internal user database. Does anyone know a command or method for that? I can't seem to find anything for this, but I would expect there to be a method that could return this similar to VisuUserManagement.g_VisuUserMgmt2.CheckLogin().

    Here is what is working so far: (please note that so long as the username and fullusername are the same, this code works fine)

    pclient2 := VisuElems.VisuElemBase.g_ClientManager.GetClientData(pClient2ID); //pClient2ID comes from button on Visualization
    LoginButton_R_TRIG(clk := LoginButton);
    arr[0] := 3; 
    arr[1] := 3; 
    IF LoginButton_R_TRIG.Q THEN
        LoginOK := VisuUserManagement.g_VisuUserMgmt2.CheckLogin(STRING_TO_WSTRING(username), STRING_TO_WSTRING(password)); //check for valid username and password
        IF LoginOK = VisuUserManagement.VUM_ReturnValues.ERR_OK THEN 
            VisuUserManagement.g_VisuUserMgmt2.LoginToUserGroups(pClient2, ADR(arr), 3, STRING_TO_WSTRING(username), STRING_TO_WSTRING(username)); //login the user
            LoginMessage:= 'LOGIN SUCCESFUL';
        ELSIF LoginOK = VisuUserManagement.VUM_ReturnValues.ERR_VUM_USER_DOES_NOT_EXIST THEN
            LoginMessage:= 'INVALID USERNAME';
        ELSIF LoginOK = VisuUserManagement.VUM_ReturnValues.ERR_VUM_WRONG_PASSWORD THEN
            LoginMessage:= 'INVALID PASSWORD';
        END_IF                  
    END_IF  
    
     

    Related

    Talk.ru: 1


Log in to post a comment.