Exemple #1
0
        public virtual void ChangePassword(SecureString newPassword)
        {
            if (newPassword == null)
            {
                throw new ArgumentNullException(nameof(newPassword));
            }
            if (connection.State != ConnectionState.Open)
            {
                throw new ArgumentException("Connection is not open");
            }

            var builder = new MySqlConnectionStringBuilder {
                ConnectionString = connection.ConnectionString
            };
            var userId = builder.UserID;

            logger.Debug($"Смена пароля для пользователя '{userId}'...");

            mySqlPasswordRepository.ChangeConnectionUserPassword(connection, newPassword.ToPlainString());

            NewPassword        = newPassword;
            PasswordWasChanged = true;

            logger.Debug("OK");
        }