Changing the password of a user via Script

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
filou
Posts: 22
Joined: Thu May 03, 2012 11:06 am

Changing the password of a user via Script

Post by filou »

Hi,

I would like to know if it's possible to change the password of a User via Script instead of using the built-in function "Show Users Dialog"?

Thank you
Regards
Philippe

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Changing the password of a user via Script

Post by mark.monroe »

Use the below code to change the user password via a script. It will not ask for the password of the user you are changing the password for.

A_User is the user name you want to change the password for.
A_Password is the new user password.

Code: Select all

using Neo.ApplicationFramework.Common.Service;
//Use the below code to change a password. It doesn't ask you for the old password.
//It just changes it to the new one.
ISecurityServiceCF securityServiceCF = ServiceContainerCF.GetService<ISecurityServiceCF>();
securityServiceCF.ChangePassword(Globals.Tags.A_User.Value, Globals.Tags.A_Password.Value);
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

filou
Posts: 22
Joined: Thu May 03, 2012 11:06 am

Re: Changing the password of a user via Script

Post by filou »

Thank you Mark Monroe !!!!

Post Reply