Skip to content
Snippets Groups Projects
account_wizard.tt2.html 4.53 KiB
  <script type="text/javascript">

jQuery(document).ready(function($){

    var form = $("#create-account-form").show();
     
        form.steps({
        headerTag: "h3",
        bodyTag: "fieldset",
        stepsOrientation: "vertical",
        transitionEffect: "slideLeft",
        //saveState: true,
        onStepChanging: function (event, currentIndex, newIndex)
        {

            // Trigger loading of the 'select_sp' with the selected SP entityid as parameter
            // Result gets included in the next tab
            if (currentIndex === 0 && newIndex === 1)
            {
                form.steps("remove", 1);
                form.steps("insert", 1, {
                    title: "Send email challenge",
                    contentMode: "async",
                    contentUrl: "[% conf.app_url %]?action=select_sp&style=nobanner&sp_entityid="+
                        encodeURIComponent($('#sp_entityid').val())
                });
            }

            // Trigger loading of the 'generate_token' with the selected SP entityid as parameter
            // Result gets included in the next tab
            if (currentIndex === 1 && newIndex === 2)
            {
                form.steps("remove", 2);
                form.steps("insert", 2, {
                    title: "Complete Email Challenge",
                    contentMode: "async",
                    contentUrl: "[% conf.app_url %]?action=generate_token&style=nobanner&sp_entityid="+
                        encodeURIComponent($('#sp_entityid').val())+"&email_address="+encodeURIComponent($("input:checked[name='email_address']").val())
                });
            }

            // Trigger loading of the 'validate_token' with the list of test accounts created
            // Result gets included in the next tab
            if (currentIndex === 2 && newIndex === 3)
            {
                window.location="[% conf.app_url %]?action=validate_token&sp_entityid="+
                        encodeURIComponent($('#sp_entityid').val())+"&authentication_token="+encodeURIComponent($('#authentication_token').val());
             }

            // Allways allow previous action even if the current form is not valid!
            if (currentIndex > newIndex)
            {
              return true;
            }
            // Needed in some cases if the user went back (clean up)
            if (currentIndex < newIndex)
            {
                // To remove error styles
                form.find(".body:eq(" + newIndex + ") label.error").remove();
                form.find(".body:eq(" + newIndex + ") .error").removeClass("error");
            }
            form.validate().settings.ignore = ":disabled,:hidden";
            return form.valid();
        
         },
        onStepChanged: function (event, currentIndex, priorIndex)
        {
        },
        onFinishing: function (event, currentIndex)
        {
            form.validate().settings.ignore = ":disabled";
            return form.valid();
        },
        onFinished: function (event, currentIndex)
        {
            alert("Submitted!");
        }
    });
    
    form.validate({
        errorPlacement: function errorPlacement(error, element) { element.before(error); },
    });

});

$(function() {
    $( "#sp_entityid" ).combobox();
    $( "#toggle" ).click(function() {
        $( "#combobox" ).toggle();
    });
});

</script>


<form id ="create-account-form"
      action="[% env.SCRIPT_NAME %]"
      method="POST">

      <h3>Select your Service Provider</h3>
<fieldset>
    <h3>Select your Service Provider</h3>
<div>
Please search and select the Service Provider that you want to test in
the list below. You must be an administrator of that Service Provider to
continue afterwards.
<br/><br/>

<label for="sp_entityid">Type the SP name or entityID to search for it.</label>
Note that only Service Providers are in the list which are included in the eduGAIN metadata.<br/>

    <select id="sp_entityid" name="sp_entityid" class="required">
        <option value="">Select your Service Provider below</option>
        [% FOREACH entity IN federation_metadata_as_hashref.sort('default_display_name') %]
<option value="[% entity.entityid %]">[% IF entity.default_display_name %][% entity.default_display_name %] [% END %]([% entity.entityid %])</option>
        [% END %]
    </select>
    <br/>
</div>
</fieldset>

<h3>Send email challenge</h3>
<fieldset>
        <div data-mode="async" data-url="/rest/service/0"></div>
</fieldset>

<h3>Complete Email Challenge</h3>
<fieldset></fieldset>

<h3>Test Accounts</h3>
<fieldset></fieldset>


</form>