<commit_before>---
title: Directory Authorization
layout: page
permalink: /directory-authorization/
---

<script>
    function requestAuth() {
        event.preventDefault();
        slug = $("#slug").val();

        function preauthorize(slug, callback) {
                var data= {
                    'slug' : slug
                }

                $.ajax({
                    type: "GET",
                    url: "http://nbdirectory.site/authorize",
                    data: data,
                    crossDomain: true,
                });

                callback(slug);
            }

        function authorization_redirect(slug) {
               url = "https://" + slug + ".nationbuilder.com/oauth/authorize?response_type=code&client_id=725cf9d4f9380b5d8946b238fb8d2f1f10c151b86dee199913ade8521679e2f6&redirect_uri=https%3A%2F%2Fwww.nbdirectory.site%2Fauthenticate";
               window.location.href = url;
        }

        preauthorize(slug, authorization_redirect());
    }
</script>

<form id="auth-form" class="clickable" onsubmit="requestAuth()">
    <input id='slug' type='text' name='nation_slug' label='Nation Slug'>
    <input id='submit' type='submit' value='Submit'>
</form><commit_msg>added clickable class<commit_after>---
title: Directory Authorization
layout: page
permalink: /directory-authorization/
---

<script>
    function requestAuth() {
        event.preventDefault();
        slug = $("#slug").val();
        console.log(slug);

        function preauthorize(slug, callback) {
                var data= {
                    'slug' : slug
                }

                $.ajax({
                    type: "GET",
                    url: "http://nbdirectory.site/authorize",
                    data: data,
                    crossDomain: true,
                });

                callback(slug);
            }

        function authorization_redirect(slug) {
               url = "https://" + slug + ".nationbuilder.com/oauth/authorize?response_type=code&client_id=725cf9d4f9380b5d8946b238fb8d2f1f10c151b86dee199913ade8521679e2f6&redirect_uri=https%3A%2F%2Fwww.nbdirectory.site%2Fauthenticate";
               window.location.href = url;
        }

       /* preauthorize(slug, authorization_redirect()); */
    }
</script>

<form id="auth-form" class="clickable" onsubmit="requestAuth()">
    <input id='slug' type='text' name='nation_slug' label='Nation Slug'>
    <input id='submit' type='submit' value='Submit'>
</form>
{'fraction_non_alphanumeric': 0.13268608414239483, 'fraction_numerical': 0.0372168284789644, 'mean_word_length': 2.075870646766169, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4493372', 'n_tokens_mistral': 803, 'n_tokens_neox': 727, 'n_words': 116}