TShockAPI.DB.User.UpgradePasswordToBCrypt C# (CSharp) Method

UpgradePasswordToBCrypt() protected method

Upgrades a password to BCrypt, from an insecure hashing algorithm.
protected UpgradePasswordToBCrypt ( string password ) : void
password string The raw user password (unhashed) to upgrade
return void
        protected void UpgradePasswordToBCrypt(string password)
        {
            // Save the old password, in the event that we have to revert changes.
            string oldpassword = Password;

            try
            {
                TShock.Users.SetUserPassword(this, password);
            }
            catch (UserManagerException e)
            {
                TShock.Log.ConsoleError(e.ToString());
                Password = oldpassword; // Revert changes
            }
        }