Files
bodyshop-uploader/BodyshopUploader/Utils/LoginHelpers.cs
2024-03-20 14:30:48 -07:00

31 lines
975 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading.Tasks;
namespace ProManagerPartner.Utils
{
public static class LoginHelpers
{
public static void SaveLoginSettings(string Username, SecureString Password)
{
Properties.Settings.Default.Username = Username;
//Todo: Figure out how to save the secure string. Perhaps serialize to JSON?
Properties.Settings.Default.Password = Password;
Properties.Settings.Default.Save();
}
public static string DecodePassword (SecureString s)
{
//Manage the secure string for the password.
IntPtr stringPointer = Marshal.SecureStringToBSTR(s);
string UP = Marshal.PtrToStringBSTR(stringPointer);
Marshal.ZeroFreeBSTR(stringPointer);
return UP;
}
}
}