public SmsMessageChannel( IOrchardServices orchardServices, IShapeFactory shapeFactory, IShapeDisplay shapeDisplay) { _shapeFactory = shapeFactory; _shapeDisplay = shapeDisplay; _smsSettings = orchardServices.WorkContext.CurrentSite.As<SmsSettingsPart>(); _smsClientField = new Lazy<TwilioRestClient>(CreateSmsClient); }
void LazyLoadHandlers(LoadContentContext context, SmsSettingsPart part) { //part.PasswordField.Getter(() => { // try { // var encryptedPassword = part.Retrieve(x => x.Password); // return String.IsNullOrWhiteSpace(encryptedPassword) ? String.Empty : Encoding.UTF8.GetString(_encryptionService.Decode(Convert.FromBase64String(encryptedPassword))); // } // catch { // Logger.Error("The email password could not be decrypted. It might be corrupted, try to reset it."); // return null; // } //}); //part.PasswordField.Setter(value => { // var encryptedPassword = String.IsNullOrWhiteSpace(value) ? String.Empty : Convert.ToBase64String(_encryptionService.Encode(Encoding.UTF8.GetBytes(value))); // part.Store(x => x.Password, encryptedPassword); //}); //part.AddressPlaceholderField.Loader(value => (string)((dynamic)ConfigurationManager.GetSection("system.net/mailSettings/smtp")).From); part.TwilioNumberPlaceholderField.Loader(value => "YYY-YYY-YYYY"); }