Community Tip - You can change your system assigned username to something more personal in your community settings. X
How can I realize the function(Logout & Change Password) in a mashup like the screenshot as follows:
Solved! Go to Solution.
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()
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()
Thanks for your answer,and the logout button is convenient to use!
Something else that is helpful, there is also AssignNewPassword
var params = {
newPasswordConfirm: undefined /* STRING */,
newPassword: undefined /* STRING */
};
// no return
Users["UserName"].AssignNewPassword(params);
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);
Issue is fixed. The root cause is that there is a minimum length for new password length which is 5.
So issue is fixed after setting newPassword nad newPasswordConfirm as "admin".
But we didnt find any instruction for this limitation till now.
Thanks,
Br,
Anna
Hi Pai,
In our application, specific user can set new password for users. but AssignNewPassword(params) is only working with Administrator user.
we can use ChangePassword(params) but it requires a old password of user, so can we get existing password of user using any service?
It will also work with SecurityAdministrators so you can set up users to have that permission.
Please note that whoever you give this permission to, can execute it not only in your mashup, but also through the REST API, so you have to make sure you think through how you give access to this functionality.
In 6.6 the FormLogin page of the Organization also has a Password reset capability.
Thanks Pai,
But i am afraid that securityAdministrators will not work with our application architecture. that user is only allowed to assign new password and restrict to other screens. Can we achieve this with any other way?
In principle the AssignPassword is an Administrative function.
So if you have architectural limitations to have Administrative functions, then you probably have a rather complicated landscape that may go beyond just a simple community answer.
As a suggestion, perhaps you can approach PTC Global Services and get architect services from PTC GS.