<commit_before>define([
    'jquery',

    'CnilModal'
], function($, CnilModal) {

    var Auth = function () {};
    Auth.prototype = {
        init: function (authconfig) {
            navigator.id.watch({
                loggedInUser: authconfig.currentUser,
                onlogin: function (assertion) {
                    $.ajax({
                        type: 'POST',
                        url: '/login',
                        data: {
                            assertion: assertion
                        },
                        success: function(res, status, xhr) {
                            if (!res.existingAccount) {
                                CnilModal.init(res.cnilUrl);
                            } else {
                                window.location = res.accountUrl;
                            }
                        },
                        error: function(xhr, status, err) {
                            navigator.id.logout();
                            // TODO translate string
                            alert("Login failure: " + err);
                        }
                    });
                },
                onlogout: function () {
                    if (window.location.pathname == '/logout') {
                        window.location.href = '/';
                    } else {
                        $.ajax({
                            type: 'POST',
                            url: '/logout',
                            success: function(res, status, xhr) {
                                window.location.reload();
                            },
                            error: function(xhr, status, err) {
                                // TODO translate string
                                alert("Logout failure: " + err);
                            }
                        });
                    }
                }
            });

            $('.sign-in').on('click', function() {
                navigator.id.request();
            });

            $('.sign-out').on('click', function() {
                navigator.id.logout();<commit_msg>Sign in and out events are live.<commit_after>define([
    'jquery',

    'CnilModal'
], function($, CnilModal) {

    var Auth = function () {};
    Auth.prototype = {
        init: function (authconfig) {
            navigator.id.watch({
                loggedInUser: authconfig.currentUser,
                onlogin: function (assertion) {
                    $.ajax({
                        type: 'POST',
                        url: '/login',
                        data: {
                            assertion: assertion
                        },
                        success: function(res, status, xhr) {
                            if (!res.existingAccount) {
                                CnilModal.init(res.cnilUrl);
                            } else {
                                window.location = res.accountUrl;
                            }
                        },
                        error: function(xhr, status, err) {
                            navigator.id.logout();
                            // TODO translate string
                            alert("Login failure: " + err);
                        }
                    });
                },
                onlogout: function () {
                    if (window.location.pathname == '/logout') {
                        window.location.href = '/';
                    } else {
                        $.ajax({
                            type: 'POST',
                            url: '/logout',
                            success: function(res, status, xhr) {
                                window.location.reload();
                            },
                            error: function(xhr, status, err) {
                                // TODO translate string
                                alert("Logout failure: " + err);
                            }
                        });
                    }
                }
            });

            $(document).on('click', '.sign-in', function () {
                navigator.id.request();
            });

            $(document).on('click', '.sign-out', function() {
                navigator.id.logout();
{'fraction_non_alphanumeric': 0.1059124767225326, 'fraction_numerical': 0.0, 'mean_word_length': 0.709908475925189, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3084951', 'n_tokens_mistral': 945, 'n_tokens_neox': 880, 'n_words': 167}