Skip to content
dek.html 5.85 KiB
Newer Older
<!DOCTYPE html>
<html>
    <head>
        {% for src in js %}
            <script type="text/javascript" src="{{ src }}"></script>
        {% endfor %}
        {% for src in css %}
            <link type="text/css" rel="stylesheet" href="{{ src }}">
        {% endfor %}
        
        <script type="text/javascript" src="{{ url_for( 'send_app_files', subpath = 'functions.js' ) }}"></script>
        <link type="text/css" rel="stylesheet" href="{{ url_for( 'send_app_files', subpath = 'app.css' ) }}">
        
        <script type="text/javascript">
            baseurl = "{{ baseurl }}";
            
            var recreate_dek_ajax = async function()
            {
                var email = $( "#email_input" ).val();
                email = await generateKey( email, "icnml_user_DEK", 20000 );
                email = email.substring( 0, 128 );
                
                $.ajax( {
                    url: "{{ url_for( 'dek_regenerate' ) }}",
                    method: "POST",
                    data: {
                        "email_hash": email
                    },
                    dataType: "json",
                    success: function( data )
                    {
                        if( ! data.error )
                        {
                            $( "#dek_create_confirmation" ).remove();
                            window.location = "{{ url_for( 'user_myprofile_dek' ) }}";
                        } else {
                            toastr.error( "Error while reconstructing the DEK" );
                        }
                    },
                    error: function( data )
                    {
                        $( "#dek_create_confirmation" ).remove();
                        toastr.error( "Network error" );
                    }
                } );
            }
            
            var recreate_dek = function()
            {
                $( "<div />" )
                    .attr( "id", "dek_create_confirmation" )
                    .text( "Do you really want to recreate the Data Encryption Key, making your biometric data available to the users of ICNML?" )
                    .append(
                        $( "<div />" )
                            .attr( "class", "icnml_box_fields" )
                            .css( "margin-top", "10px" )
                            .append(
                                $( "<label />" )
                                    .attr( "for", "email_input" )
                                    .text( "Email" )
                            )
                            .append(
                                $( "<input />" )
                                    .attr( "id", "email_input" )
                            )
                    )
                    .dialog( {
                        title: "Confirm Data Encryption Key generation",
                        modal: true,
                        width: "550px",
                        buttons: {
                            "Re-generate": function(){
                                recreate_dek_ajax();
                            },
                            "Cancel": function()
                            {
                                $( this ).dialog( "close" );
                            },
                        },
                        close: function()
                        {
                            $( this ).remove();
                        }
                    } );
                
                $( "#email_input" ).on( "keypress", function( event )
                {
                    if( event.keyCode == 13 )
                    {
                        recreate_dek_ajax();
                    }
                } );
            }
        </script>
        
        <style type="text/css">
            .icnml_button {
                margin-top: 50px;
            }
            .icnml_button > div > a {
                width: 200px;
                margin-bottom: 10px;
                padding: 10px;
            }
        </style>
    </head>
    <body class="icnml_main_layout">
        {% include "header.html" %}
        {% include navigation %}
        
        <div class="icnml_content">
            {% if not has_dek %}
                <div style="margin: 10px;">
                    <p style="color: #ff0000; font-size: 30px; font-weight: bolder;">
                        You don't have anymore a Data Encryption Key (DEK) in ICNML.
                    </p>
                    
                    <p>
                        This imply that your data, in particular all biometric information (tenprint and latent marks) are not available as part of the ICNML data.
                    </p>
                    
                    <p>
                        For privacy purpose, the original submitter of your biometric data can still see the uploaded data.
                        This is done to prevent the submitter knowing that you have requested a deletion of ICNML.
                    </p>
                    
                    <div class="icnml_button">
                        <div id="create_dek_button_div">
                            <a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="dek_button" role="button" aria-disabled="false">
                                <span class="ui-button-text" id="dek_button_span_text">Reconstruct DEK</span>
                            </a>
                        </div>
                    </div>
                </div>
            {% else %}
            {% endif %}
        </div>
        
        <script type="text/javascript">
            $( "#dek_button" ).on( "click", recreate_dek );
            
            $( "#icnml_navigation_dek" )
                .addClass( "activated" );
            
            $( "#navloc" ).append(
                $( "<span />" ).text( "My user profile" )
            );
        </script>
    </body>
</html>