Skip to main content
1-Visitor
November 2, 2015
Solved

Logout & Change Password

  • November 2, 2015
  • 2 replies
  • 5062 views

How can I realize the function(Logout & Change Password) in a mashup like the  screenshot as follows:

捕获.PNG

    Best answer by CarlesColl

    For the Logout, you need to download the Logout Button Widget: ThingWorx IoT Marketplace » Logout Button

    For the Change Password, I think you can do it from Server Side Javascript with this code ( I've never tested it 😞

    var params = {

      newPasswordConfirm: undefined /* STRING */,

      oldPassword: undefined /* STRING */,

      newPassword: undefined /* STRING */

    };

    Users[user_name].ChangePassword(params);

    For instance for user_name you can use: Resources["CurrentSessionInfo"].GetCurrentUser()

    2 replies

    1-Visitor
    November 2, 2015

    For the Logout, you need to download the Logout Button Widget: ThingWorx IoT Marketplace » Logout Button

    For the Change Password, I think you can do it from Server Side Javascript with this code ( I've never tested it 😞

    var params = {

      newPasswordConfirm: undefined /* STRING */,

      oldPassword: undefined /* STRING */,

      newPassword: undefined /* STRING */

    };

    Users[user_name].ChangePassword(params);

    For instance for user_name you can use: Resources["CurrentSessionInfo"].GetCurrentUser()

    kqian1-VisitorAuthor
    1-Visitor
    November 17, 2015

    Thanks for your answer,and the logout button is convenient to use!

    1-Visitor
    November 17, 2015

    Something else that is helpful, there is also AssignNewPassword

    var params = {

      newPasswordConfirm: undefined /* STRING */,

      newPassword: undefined /* STRING */

    };

    // no return

    Users["UserName"].AssignNewPassword(params);

    14-Alexandrite
    November 18, 2015

    Hi Pai,

    Have you tested against service AssignNewPassword? I got error when test this service:

    Wrapped java.lang.Exception: Invalid New Password Specified Cause: Invalid New Password Specified


    This is my code:

    var params = {

        newPasswordConfirm: "abc" /* STRING */,

        newPassword: "abc" /* STRING */

    };

    // no return

    Users["MyUserName"].AssignNewPassword(params);