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

Login Dialog Feedback and Checking Password

jadchamas
2020-07-18
2021-12-16
  • jadchamas - 2020-07-18

    Hi all,

    I am working on creating a login dialog with username and password in Codesys 3.5 visualization, and it worked (attached photo).
    I need to know how to get certain feedback variables, like if the login operation is successful or not and if the password put is correct or not. This will help me in creating a condition on VISU_TASK in Task Configuration, because the variables in my application are always shown in real time even before logging in and putting the username and password. I need the task cycle to be launched only after a successful login.

    Could you please advise me how to solve this problem, or how to get login feedback variables and what library to use ?

    Thank you.

     
    πŸ‘
    1
  • Morberis

    Morberis - 2020-07-20

    I have not tinkered with that like you have. There are a number of variables present in VUM_ReturnValues as part of the VisuUserMgmt library.

    Here is a link to the library documentation.
    https://help.codesys.com/webapp/idx-VisuUserMgmt_Itfs-lib;product=VisuUserMgmt_Itfs;version=3.5.9.0

     

    Last edit: Morberis 2020-07-20
    • jadchamas - 2020-07-20

      Hi,

      I used the structure VUM_ReturnValues in the library VisuUserManagement.VisuUserManagement_Interfaces, for some variables like 'No error', 'Operation failed', 'Wrong Password'..(attached screenshots), and I entered wrong usernames and passwords but actually I don't see any change in these feedback variables.

       
  • m.prestel - 2020-07-21

    Hey,
    you cannot create a condition and disable the VISU_TASK until a user is logged in otherwise no user will be able to login (since the visu login is done in the VISU_TASK).
    If you don't want to show variables to non logged in users, I would recommend you use access properties provided at each element (https://help.codesys.com/webapp/_visu_dlg_access_rights;product=core_visualization;version=3.5.16.0)

    Best regards,
    Marcel

     
    • Morberis

      Morberis - 2020-07-21

      Good catch.

      But what if you wanted to do something based on the login status. Like change the current visu variable, or change other variables. I can think of maybe a few things to do with it.

      How would you read that? I would have guessed that the VUM_ReturnValues structure would allow that.

       
      • m.prestel - 2020-07-22

        There is a event listener do get login/logouts and wrong logins.
        The interface is IUserMgmtEventHandler and can be found in VisuElemBase (VisuElems.IUserMgmtEventHandler)

        Set the listener with VisuElems.g_VisuEventManager.SetUserMgmtEventHandler()

        Attached you can find a small example.

        Best regards,
        Marcel

         
  • Riccardo - 2021-12-01

    .

     

    Last edit: Riccardo 2021-12-01
  • Riccardo - 2021-12-16

    Hallo Jadchamas,

    You can use
    VisuElems.CurrentUserGroupId.
    It is a variable setted to 0 when no one is loggedin and has a different value when an user is logged.
    The value it has depend on the group at which the user is part.

    For what concern the identification of the user I don't know if exist an user ID but you could use:
    VisuElems.currentUserFullName
    It gives you a string or wstring, I don't remember, with the name of the user, you can use it to show what you wish.

     

Log in to post a comment.