working on it ...

Filters

Explore Public Snippets

Sort by

Found 668 snippets matching: confirmation

    public by cghersi @ MailUp API DEV  206844  8  6  1

    MailUp REST API - How to subscribe to a particular list several contacts with the "Confirmed Optin" Procedure

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void SubcribeRecipientsWithDoubleOptin(string clientID, string clientSecret, string username, string password)
    {
        // 1) Setup the MailUp Client:
        MailUpClient client = new MailUpClient(clientID, clientSecret);
        try
        {
            client.RetrieveAccessToken(username, password);
        }
        catch (MailUpException ex)
        {
            Console.WriteLine("Unable to access the service due to " + ex.Message);
            return;
        }
    
        // 2) Subscribe recipients:
        int idList = 1;
        List<ConsoleRecipientItem> recipients = new List<ConsoleRecipientItem>();
        ConsoleRecipientItem recipient1 = new ConsoleRecipientItem()
        {
            Email = "test1@mailup.com",
            Name = "First New Recipient" + DateTime.Now.ToFileTimeUtc(),
            MobileNumber = "3331234567",
            MobilePrefix = "39",
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name1_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName1_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        ConsoleRecipientItem recipient2 = new ConsoleRecipientItem()
        {
            Email = "test2@mailup.com",
            Name = "Second New Recipient" + DateTime.Now.ToFileTimeUtc(),
            MobileNumber = "3337654321",
            MobilePrefix = "39",
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name2_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName2_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        recipients.Add(recipient1);
        recipients.Add(recipient2);
        int subscriptionResult = 0;
        try
        {
            subscriptionResult = client.AddRecipientsToList(idList, recipients, true);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot perform the operation due to " + ex.Message);
            return;
        }
    
        // 2.1) wait for the end of import task:
        if (subscriptionResult > 0)
        {
            Console.WriteLine("Recipients Import started; import ID:" + subscriptionResult);
    
            //optionally we can check the import status:
            bool completed = false;
            do
            {
                ConsoleImportStatus importStatus = client.CheckImportStatus(subscriptionResult);
                if (importStatus == null)
                {
                    Console.WriteLine("Cannot check the import status for import task #" + subscriptionResult);
                    return;
                }
                completed = importStatus.Completed;
            } while (!completed);
            Console.WriteLine("Recipients Added!");
        }
        else
        {
            Console.WriteLine("An error occurred while adding the recipients.");
            return;
        }
    
        // 3) Retrieve the sendingID of the confirmation email related to the previous task:
        int sendingID = -1;
        try
        {
            sendingID = client.GetSendingIDForImport(subscriptionResult);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot retrieve sending ID due to " + ex.Message);
            return;
        }
        if (sendingID <= 0)
        {
            Console.WriteLine("Cannot retrieve sending ID.");
            return;
        }
    
        // 4) Send the confirmation email:
        EmailSendingItem sendingResult = null;
        try
        {
            sendingResult = client.SendEmailMessage(sendingID);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot send email due to " + ex.Message);
            return;
        }
        if (sendingResult == null)
            Console.WriteLine("Cannot send confirmation email.");
        else
            Console.WriteLine("Confirmation email sent!");
    }
                

    public by cghersi @ MailUp API DEV  1585  16  6  0

    MailUp REST API - How to subscribe a single contact with the "Confirmed Optin" Procedure

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void SubscribeContactWithCOI(string clientID, string clientSecret, string username, string password)
    {
      // 1) Setup the MailUp Client:
      MailUpClient client = new MailUpClient(clientID, clientSecret);
      try
      {
        client.RetrieveAccessToken(username, password);
      }
      catch (MailUpException ex)
      {
        Console.WriteLine("Unable to access the service due to " + ex.Message);
        return;
      }
    
      // 2) Prepare the input:
      int idList = 1;
      ConsoleRecipientItem recipient = new ConsoleRecipientItem()
      {
        Email = "test1COI@mailup.com",
        Name = "First COI New Recipient" + DateTime.Now.ToFileTimeUtc(),
        Fields = new List<ConsoleRecipientDynamicFieldItem>()
        {
            new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name1COI_" + DateTime.Now.ToFileTimeUtc() },
            new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName1COI_" + DateTime.Now.ToFileTimeUtc() }
            //here you can add all the fields you want to add...
        }
      };
    
      // 3) Invoke the web method:
      int result = 0;
      try
      {
        result = client.AddRecipientToList(idList, recipient, true);
      }
      catch (Exception ex)
      {
        Console.WriteLine("Cannot perform the operation due to " + ex.Message);
        return;
      }
    
      // 4) Print results:
      if (result > 0)
        Console.WriteLine("Recipients Added with confirmed Opt-in! The ID of the recipient is " + result);
      else
        Console.WriteLine("An error occurred while adding the recipients with confirmed Opt-in.");
    }
                

    public by michaelbukachi  1037  0  6  0

    Javafx confirmation dialog

    Utility method to show a confirmation dialog using javafx
    private boolean showConfirmationDialog(String message) {
    		Alert alert = new Alert(AlertType.CONFIRMATION);
    		alert.setTitle("Confirm Action");
    		alert.setHeaderText(null);
    		alert.setContentText(message);
    		Optional<ButtonType> result = alert.showAndWait();
    		
    		return result.get() == ButtonType.OK;
    	}

    public by cghersi @ MailUp API DEV  999  1  5  0

    How to Add multiple recipients to a list of recipients with confirmed OptIn with MailUp .NET SDK

    This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication. You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API An instance of MailUpClient class is able to manage one user at a time. A MailU
    public static void SubscribeRecipientsWithConfirmedOptin(string clientID, string clientSecret, string username, string password)
    {
        // 1) Setup the MailUp Client:
        MailUpClient client = new MailUpClient(clientID, clientSecret);
        try
        {
            client.RetrieveAccessToken(username, password);
        }
        catch (MailUpException ex)
        {
            Console.WriteLine("Unable to access the service due to " + ex.Message);
            return;
        }
    
        // 2) Prepare the input:
        int idList = 1;
        List<ConsoleRecipientItem> recipients = new List<ConsoleRecipientItem>();
        ConsoleRecipientItem recipient1 = new ConsoleRecipientItem()
        {
            Email = "test1COI@mailup.com",
            Name = "First COI New Recipient" + DateTime.Now.ToFileTimeUtc(),
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name1COI_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName1COI_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        ConsoleRecipientItem recipient2 = new ConsoleRecipientItem()
        {
            Email = "test2COI@mailup.com",
            Name = "Second COI New Recipient" + DateTime.Now.ToFileTimeUtc(),
            Fields = new List<ConsoleRecipientDynamicFieldItem>()
            {
                new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name2COI_" + DateTime.Now.ToFileTimeUtc() },
                new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName2COI_" + DateTime.Now.ToFileTimeUtc() }
                //here you can add all the fields you want to add...
            }
        };
        recipients.Add(recipient1);
        recipients.Add(recipient2);
    
        // 3) Invoke the web method:
        int result = 0;
        try
        {
            result = client.SubscribeRecipientsWithConfirmedOptin(idList, recipients);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Cannot perform the operation due to " + ex.Message);
            return;
        }
    
        // 4) Print results:
        if (result > 0)
        {
            Console.WriteLine("Recipients Import started; import ID:" + result);
    
            //optionally we can check the import status:
            bool completed = false;
            do
            {
                ConsoleImportStatus importStatus = client.CheckImportStatus(result);
                if (importStatus == null)
                {
                    Console.WriteLine("Cannot check the import status for import task #" + result);
                    return;
                }
                completed = importStatus.Completed;
            } while (!completed);
            Console.WriteLine("Recipients Added with confirmed Opt-in!");
        }
        else
            Console.WriteLine("An error occurred while adding the recipients with confirmed Opt-in.");
    }
    

    public by msdn  77003  0  6  0

    ChangeSettingsCertificate: Load all service configurations in provided directory. Decrypt with existing thumbprint, change thumbprint to new value and re-encrypt. This just changes the settings values. You should have already gott...

    Load all service configurations in provided directory. Decrypt with existing thumbprint, change thumbprint to new value and re-encrypt. This just changes the settings values. You should have already gotten the certificate into the csdef/cscfg and uploaded to the role on azure. Directory containing .cscfg files to migrate to new cert New c
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Xml.Linq;
    
    /// <summary>
    /// Load all service configurations in provided directory. Decrypt with existing thumbprint, 
    /// change thumbprint to new value and re-encrypt. This just changes the settings values.
    /// You should have already gotten the certificate into the csdef/cscfg and uploaded to the role on azure.
    ///  </summary>
    /// <param name="cscfgRootDir">Directory containing .cscfg files to migrate to new cert</param>
    /// <param name="newSettingsCertThumbprint">New certificate thumbprint value</param>
    /// <param name="interactive">Prompt for confirmation before saving files? Default false.</param>
    public static void ChangeSettingsCertificate(string cscfgRootDir, string newSettingsCertThumbprint, bool interactive = false)
    {
        foreach (var cfgTuple in GetConfigs(cscfgRootDir))
        {
            var filename = Path.GetFileName(cfgTuple.Item1);
            var settingsDoc = cfgTuple.Item2;
            Console.WriteLine(@">>>>> Decrypting {0}...", filename);
            DecryptSettings(settingsDoc);
            Console.WriteLine(@">>>>> Changing Thumbprint {0}...", filename);
            foreach (var roleSettings in RawSettingsForRoles(settingsDoc))
            {
                if (!string.IsNullOrEmpty(roleSettings.Value["SettingsCertificateThumbprint"]))
                {
                    if (!GetCertThumbprints(roleSettings.Value.RoleElement).Contains(newSettingsCertThumbprint))
                    {
                        throw new InvalidOperationException(string.Format(
                                "New certificate thumbprint {0} not present in certificates configuration for role {1} in {2}",
                                newSettingsCertThumbprint, roleSettings.Key, filename));
                    }
                    roleSettings.Value["SettingsCertificateThumbprint"] = newSettingsCertThumbprint;
                }
            }
            Console.WriteLine(@">>>>> Re-encrypting with new certificate {0}...", filename);
            EncryptSettings(settingsDoc);
            Console.WriteLine();
        }
        Console.WriteLine(@" ==== Completed. {0} ==== ", interactive ? "Save Changes (y/n)?" : "Saving changes...");
        if (!interactive || Console.ReadKey().KeyChar == 'y')
        {
            foreach (var cfgTuple in GetConfigs(cscfgRootDir))
            {
                cfgTuple.Item2.Save(cfgTuple.Item1);
            }
            Console.WriteLine(@"Saved.");
        }
        else
        {
            Console.WriteLine(@"Aborted.");
        }
    }

    external by JB Nizet  74859  38  3  0

    How to create a reusable service allowing to open a confirmation modal from anywhere with ng-bootstrap

    How to create a reusable service allowing to open a confirmation modal from anywhere with ng-bootstrap: confirm-modal-and-service.ts
    import { Component, Injectable, Directive, TemplateRef } from '@angular/core';
    import { NgbModal, NgbModalRef, NgbModalOptions } from '@ng-bootstrap/ng-bootstrap';
    
    /**
     * Options passed when opening a confirmation modal
     */
    interface ConfirmOptions {
      /**
       * The title of the confirmation modal
       */
      title: string,
    
      /**
       * The message in the confirmation modal
       */
      message: string
    }
    
    /**
     * An internal service allowing to access, from the confirm modal component, the options and the modal reference.
     * It also allows registering the TemplateRef containing the confirm modal component.
     *
     * It must be declared in the providers of the NgModule, but is not supposed to be used in application code
     */
    @Injectable()
    export class ConfirmState {
      /**
       * The last options passed ConfirmService.confirm()
       */
      options: ConfirmOptions;
    
      /**
       * The last opened confirmation modal
       */
      modal: NgbModalRef;
    
      /**
       * The template containing the confirmation modal component
       */
      template: TemplateRef<any>;
    }
    
    /**
     * A confirmation service, allowing to open a confirmation modal from anywhere and get back a promise.
     */
    @Injectable()
    export class ConfirmService {
    
      constructor(private modalService: NgbModal, private state: ConfirmState) {}
    
      /**
       * Opens a confirmation modal
       * @param options the options for the modal (title and message)
       * @returns {Promise<any>} a promise that is fulfilled when the user chooses to confirm, and rejected when
       * the user chooses not to confirm, or closes the modal
       */
      confirm(options: ConfirmOptions): Promise<any> {
        this.state.options = options;
        this.state.modal = this.modalService.open(this.state.template);
        return this.state.modal.result;
      }
    }
    
    /**
     * The component displayed in the confirmation modal opened by the ConfirmService.
     */
    @Component({
      selector: 'confirm-modal-component',
      template: `<div class="modal-header">
        <button type="button" class="close" aria-label="Close" (click)="no()">
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">{{ options.title}}</h4>
      </div>
      <div class="modal-body">
        <p>{{ options.message }}</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" (click)="yes()">Yes</button>
        <button type="button" class="btn btn-secondary" (click)="no()">No</button>
      </div>`
    })
    export class ConfirmModalComponent {
    
      options: ConfirmOptions;
    
      constructor(private state: ConfirmState) {
        this.options = state.options;
      }
    
      yes() {
        this.state.modal.close('confirmed');
      }
    
      no() {
        this.state.modal.dismiss('not confirmed');
      }
    }
    
    /**
     * Directive allowing to get a reference to the template containing the confirmation modal component,
     * and to store it into the internal confirm state service. Somewhere in the view, there must be
     *
     * ```
     * <template confirm>
     *   <confirm-modal-component></confirm-modal-component>
     * </template>
     * ```
     *
     * in order to register the confirm template to the internal confirm state
     */
    @Directive({
      selector: "template[confirm]"
    })
    export class ConfirmTemplateDirective {
      constructor(confirmTemplate: TemplateRef<any>, state: ConfirmState) {
        state.template = confirmTemplate;
      }
    }
    
    @Component({
      selector: 'some-applicative-component',
      templateUrl: './some-applicative-component.html'
    })
    export class SomeApplicativeComponent {
      constructor(private confirmService: ConfirmService) {}
    
      deleteFoo() {
        this.confirmService.confirm({ title:'Confirm deletion', message: 'Do you really want to delete this foo?' }).then(
          () => {
            console.log('deleting...');
          },
          () => {
            console.log('not deleting...');
          });
      }
    }
    
    
    

    external by amogower  114  0  2  0

    Linking directly to the confirmation email sent to the user speeds up the email confirmation process.

    Linking directly to the confirmation email sent to the user speeds up the email confirmation process.: Gmail Confirmation Email Search Link
    Once the confirmation email has been sent, show a button labeled “Open in Gmail” on the confirmation page that links to a Gmail search for the confirmation email. This way the user can find the right the email with one click, quickly confirm, and complete the sign up process.
    
    The following search query tends to find the email:
    
    in:anywhere subject:”Confirm your awesomess” from:team@betalist.com
    
    Here’s what the link looks like as a URL:
    
    https://mail.google.com/mail/u/0/#search/in%3Aanywhere+subject%3A%22Confirm%20your%20awesomeness%22+from%3Ateam%40betalist.com
    
    

    external by douglascorrea  91  1  1  0

    Password Confirmation AngularJS directive

    Password Confirmation AngularJS directive: passwordConfirmation.js
    /*
    How to use:
        on inputs:
            <input type="password" id="pw2" name="pw2"
                ng-model="pw2" ng-required="" password-confirm="pw1" />
        get errors with:
            "myForm.pw2.$error.passwordmatch"
    */
    angular.module('myApp')
        .directive('passwordConfirm', [function () {
            return {
                require: 'ngModel',
                link: function (scope, elem, attrs, ctrl) {
                    var me = attrs.ngModel;
                    var matchTo = attrs.passwordConfirm;
    
                    scope.$watch('[me, matchTo]', function(value){
                        ctrl.$setValidity('passwordmatch', scope.$eval(me) === scope.$eval(matchTo) );
    
                    });
                }
            };
        }]);
    
    

    external by GabeStah  91  0  1  0

    [WoW] Skip confirmation dialog for Trading Post <Trader> purchases

    [WoW] Skip confirmation dialog for Trading Post purchases: gistfile1.txt
    /run StaticPopupDialogs['CONFIRM_PURCHASE_TOKEN_ITEM'].OnShow = function() _,_,_,_,_,d=strsplit('-',UnitGUID('target')or'')if tContains({86777,87200,86779,87201,86778,86776,86683,87203,87202},tonumber(d)) then StaticPopup1Button1:Click() end end
    
    

    external by leepettijohn  91  0  1  0

    Gravity Form - Scroll to Confirmation Box

    Gravity Form - Scroll to Confirmation Box: functions.php
    add_filter( 'gform_confirmation_anchor', '__return_true' );
    
    
    
    • Public Snippets
    • Channels Snippets