-
-
Save ShilGen/dcb0d53907a1dd77a7d08d8997d5ede6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ObjStudioClasses; | |
using System; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Xml; | |
using System.Threading.Tasks; | |
public class Script | |
{ | |
private static byte[] CalcPasswordHash(string password) | |
{ | |
using (var stream = new MemoryStream()) | |
{ | |
using (var writer = new StreamWriter(stream)) | |
{ | |
writer.Write(password); | |
} | |
using (var md5 = System.Security.Cryptography.MD5.Create()) | |
{ | |
return md5.ComputeHash(stream.ToArray()); | |
} | |
} | |
} | |
public static object Execute() | |
{ | |
var user = InnerUser.GetInstances().Single(x => x.AttributeLogin == "Administrator"); | |
user.AttributeAuthenticationRules.AttributeExternalPasswordHash = CalcPasswordHash("1234"); | |
user.AttributeUserStatus=UserStatusItem.Instances.Active; | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment