Commit 2d55a157 authored by Romain Loth's avatar Romain Loth

elements for the flask development server (in production will be => static)

parents
This folder contains oct 2016 registration form and cgi
=======================================================
=> the form is static and uses js for validation etc
=> the answers are POSTed to a cgi script that writes the new users in a local DB
contact: `romain.loth@iscpif.fr`
"""
Flask server used to test the registration page for comex app
(in production this script is not used anymore
=> the registration page will be a static form
with js and cgi-bin answers management )
"""
__author__ = "CNRS"
__copyright__ = "Copyright 2016 ISCPIF-CNRS"
__version__ = "1"
__email__ = "romain.loth@iscpif.fr"
__status__ = "Test"
from flask import Flask, render_template, request
from ctypes import c_int
from time import sleep
# ============= app creation =============
app = Flask(__name__)
app.config['DEBUG'] = True
# ============= views =============
@app.route("/", methods=['GET','POST'])
def one_big_form():
if request.method == 'GET':
return render_template("base_layout.html")
elif request.method == 'POST':
# ex: request.form = ImmutableMultiDict([('initials', 'R.L.'), ('email', 'romain.loth@iscpif.fr'), ('last_name', 'Loth'), ('country', 'France'), ('first_name', 'Romain'), ('my-captchaHash', '-773776109'), ('my-captcha', 'TSZVIN')])
# print("GOT ANSWERS <<========<<", request.form)
# 1 - testing the captcha answer
userinput = request.form['my-captcha']
userhash = re_hash(userinput)
captchash = int(request.form['my-captchaHash'])
if userhash != captchash:
print("captcha rejected")
sleep(3)
return render_template("thank_you.html", form_accepted = False)
# normal case
else:
print("OK accepted")
return render_template("thank_you.html", form_accepted = True)
# def re_hash(userinput, salt="#salt"):
def re_hash(userinput, salt=""):
"""
my rewrite of keith-wood.name/realPerson.html python's version
"""
hashk = 5381
value = userinput.upper() + salt
for i, char in enumerate(value):
hashk = c_int( ((hashk << 5) + hashk + ord(char)) & 0xFFFFFFFF ).value
# bitwise masks 0xFFFFFFFF to go back to int32 each time
# c_int( previous ).value to go from unsigned ints to c signed ints each time
print(i, hashk)
return hashk
if __name__ == "__main__":
app.run()
This diff is collapsed.
<!DOCTYPE html>
<html lang="fr-FR">
<head>
<meta charset="utf-8">
<title>Formulaire Community Explorer : se ré-enregistrer</title>
<meta name="description" content="Formulaire d'enregistrement sur la plateforme Community Explorer (ISCPIF CNRS UPS 3611)">
<meta name="keywords" content="complex systems, community, registration form">
<!-- CSS -->
<link type=text/css rel=stylesheet href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
<link type=text/css rel=stylesheet href="{{ url_for('static', filename='css/topbar_bootstrap_retrocompatibility.css') }}">
<link type=text/css rel=stylesheet href="{{ url_for('static', filename='js/jquery-ui-1.12.1/jquery-ui.min.css') }}">
<style type="text/css" media="screen">
.white { color:#fff ; }
.page {
margin-top: 45px; /* topbar height is 40px */
}
/* for intro text */
.mini-hero {
margin-top: 1.5em;
font-size: 18px;
line-height: 27px;
}
/* page sections: style snippets from old bootstrap h2 */
h2.oldstyle {
font-family: Ubuntu, sans-serif;
font-size: 24px;
font-weight: bold;
line-height: 18px ;
}
.spacerrow {
height: 5em;
}
.bigspacerrow {
height: 50em;
}
</style>
<!-- ## JS ## -->
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//piwik.iscpif.fr/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '4']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//piwik.iscpif.fr/piwik.php?idsite=4" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</head>
<body>
<div class="topbar" style="opacity: 0.93;">
<div class="topbar-inner">
<div class="container-fluid">
<a class="brand" href="http://communityexplorer.org/index.html">
<span class="glyphicon glyphicon-home white"></i></a>
<ul class="white nav">
<li>
<a id="truc" href="http://communityexplorer.org/#"> <strong>Complex systems community explorer</strong></a>
</li>
</ul>
</div>
</div>
</div>
<div class="page container-fluid">
<div class="row spacerrow">&nbsp;</div>
<div class="row">
<div class="spacer col-sm-1 col-md-1">&nbsp;</div>
<div class="my_form_box col-sm-8 col-md-8">
<!-- INTRODUCTION TEXT -->
<div id="intro">
<h2 class="oldstyle">Registration form</h2>
<p class="mini-hero">
{% if form_accepted %}
Thank you for your answers ! We'll soon update the <strong>Community Explorer</strong> database with all the new information.
{% else %}
Your answers couldn't be accepted because you filled some wrong information in the verification test !
{% endif %}
</p>
</div>
</div>
<div class="spacer col-sm-2 col-md-2">&nbsp;</div>
</div>
<div class="row bigspacerrow">&nbsp;</div>
<!-- FOOTER TEXT AND LINKS -->
<footer>
<!-- This directory is maintained by the <a href="http://cssociety.org" target="blank">Complex Systems Society</a>
and the <a href="http://iscpif.fr" target="blank">Complex Systems Institute of Paris Ile-de-France</a>.<br/>-->
<center>
<a href="http://communityexplorer.org/about.html"><span class="glyphicon glyphicon-question-sign"></span> About</a> -
<a href="http://moma.csregistry.org/feedback" target="BLANK"><span class="glyphicon glyphicon-repeat"></span> Feedback</a> -
<a href="http://communityexplorer.org/privacy.html"> <span class="glyphicon glyphicon-list-alt"></span> Privacy</a>
<br>
Directory maintained by the
<a href="http://cssociety.org/" target="blank"> Complex Systems Society</a> and the
<a href="http://iscpif.fr/" target="blank">Complex Systems Institute of Paris Ile-de-France</a>.
<br>
<a href="http://cssociety.org/" target="_BLANK">
<img src="{{ url_for('static', filename='images/css.png') }}" alt="http://cssociety.org"
style="border: none; margin-bottom : -6px;"
title="isc-pif" height="25px">
</a>
<a href="http://iscpif.fr/">
<img src="{{ url_for('static', filename='images/iscpif_short.png') }}" alt="iscpif.fr"
style="border: none; margin-bottom : -6px;"
title="isc-pif">
</a>
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="blank">
<img alt="Creative Commons License" style="border: none; margin-bottom : -6px;" src="{{ url_for('static', filename='images/cc.png') }}" height="20px">
</a> -
<!-- <a href="http://moma.csregistry.org/" target="_BLANK"> MOMA</a> - -->
<a href="http://iscpif.fr/" target="_BLANK">ISC-PIF</a> -
<a href="http://www.cnrs.fr/fr/recherche/index.htm" target="_BLANK">CNRS</a>.
</center>
<p>&nbsp;</p>
</footer>
</div>
</body>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
/*!
* Excerpt from Bootstrap v1.4.0 Copyright 2011 Twitter, Inc
* with all top toolbar elements' css as they were back then...
*/
.topbar {
height: 40px;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 10000;
overflow: visible;
}
.topbar a {
color: #bfbfbf;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.topbar h3 a:hover, .topbar .brand:hover, .topbar ul .active > a {
background-color: #333;
background-color: rgba(255, 255, 255, 0.05);
color: #fff;
text-decoration: none;
}
.topbar h3 {
position: relative;
}
.topbar h3 a, .topbar .brand {
float: left;
display: block;
padding: 8px 20px 12px;
margin-left: -20px;
color: #fff;
font-size: 20px;
font-weight: 200;
line-height: 1;
}
.topbar p {
margin: 0;
line-height: 40px;
}
.topbar p a:hover {
background-color: transparent;
color: #fff;
}
.topbar form {
float: left;
margin: 5px 0 0 0;
position: relative;
filter: alpha(opacity=100);
-khtml-opacity: 1;
-moz-opacity: 1;
opacity: 1;
}
.topbar form.pull-right {
float: right;
}
.topbar input {
background-color: #444;
background-color: rgba(255, 255, 255, 0.3);
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: normal;
font-weight: 13px;
line-height: 1;
padding: 4px 9px;
color: #fff;
color: rgba(255, 255, 255, 0.75);
border: 1px solid #111;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
-webkit-transition: none;
-moz-transition: none;
-ms-transition: none;
-o-transition: none;
transition: none;
}
.topbar input:-moz-placeholder {
color: #e6e6e6;
}
.topbar input::-webkit-input-placeholder {
color: #e6e6e6;
}
.topbar input:hover {
background-color: #bfbfbf;
background-color: rgba(255, 255, 255, 0.5);
color: #fff;
}
.topbar input:focus, .topbar input.focused {
outline: 0;
background-color: #fff;
color: #404040;
text-shadow: 0 1px 0 #fff;
border: 0;
padding: 5px 10px;
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
}
.topbar-inner, .topbar .fill {
background-color: #222;
background-color: #222222;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));
background-image: -moz-linear-gradient(top, #333333, #222222);
background-image: -ms-linear-gradient(top, #333333, #222222);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));
background-image: -webkit-linear-gradient(top, #333333, #222222);
background-image: -o-linear-gradient(top, #333333, #222222);
background-image: linear-gradient(top, #333333, #222222);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}
.topbar div > ul, .nav {
display: block;
float: left;
margin: 0 10px 0 0;
position: relative;
left: 0;
}
.topbar div > ul > li, .nav > li {
display: block;
float: left;
}
.topbar div > ul a, .nav a {
display: block;
float: none;
padding: 10px 10px 11px;
line-height: 19px;
text-decoration: none;
}
.topbar div > ul a:hover, .nav a:hover {
color: #fff;
text-decoration: none;
}
.topbar div > ul .active > a, .nav .active > a {
background-color: #222;
background-color: rgba(0, 0, 0, 0.5);
}
.topbar div > ul.secondary-nav, .nav.secondary-nav {
float: right;
margin-left: 10px;
margin-right: 0;
}
.topbar div > ul.secondary-nav .menu-dropdown,
.nav.secondary-nav .menu-dropdown,
.topbar div > ul.secondary-nav .dropdown-menu,
.nav.secondary-nav .dropdown-menu {
right: 0;
border: 0;
}
.topbar div > ul a.menu:hover,
.nav a.menu:hover,
.topbar div > ul li.open .menu,
.nav li.open .menu,
.topbar div > ul .dropdown-toggle:hover,
.nav .dropdown-toggle:hover,
.topbar div > ul .dropdown.open .dropdown-toggle,
.nav .dropdown.open .dropdown-toggle {
background: #444;
background: rgba(255, 255, 255, 0.05);
}
.topbar div > ul .menu-dropdown,
.nav .menu-dropdown,
.topbar div > ul .dropdown-menu,
.nav .dropdown-menu {
background-color: #333;
}
.topbar div > ul .menu-dropdown a.menu,
.nav .menu-dropdown a.menu,
.topbar div > ul .dropdown-menu a.menu,
.nav .dropdown-menu a.menu,
.topbar div > ul .menu-dropdown .dropdown-toggle,
.nav .menu-dropdown .dropdown-toggle,
.topbar div > ul .dropdown-menu .dropdown-toggle,
.nav .dropdown-menu .dropdown-toggle {
color: #fff;
}
.topbar div > ul .menu-dropdown a.menu.open,
.nav .menu-dropdown a.menu.open,
.topbar div > ul .dropdown-menu a.menu.open,
.nav .dropdown-menu a.menu.open,
.topbar div > ul .menu-dropdown .dropdown-toggle.open,
.nav .menu-dropdown .dropdown-toggle.open,
.topbar div > ul .dropdown-menu .dropdown-toggle.open,
.nav .dropdown-menu .dropdown-toggle.open {
background: #444;
background: rgba(255, 255, 255, 0.05);
}
.topbar div > ul .menu-dropdown li a,
.nav .menu-dropdown li a,
.topbar div > ul .dropdown-menu li a,
.nav .dropdown-menu li a {
color: #999;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
.topbar div > ul .menu-dropdown li a:hover,
.nav .menu-dropdown li a:hover,
.topbar div > ul .dropdown-menu li a:hover,
.nav .dropdown-menu li a:hover {
background-color: #191919;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919));
background-image: -moz-linear-gradient(top, #292929, #191919);
background-image: -ms-linear-gradient(top, #292929, #191919);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919));
background-image: -webkit-linear-gradient(top, #292929, #191919);
background-image: -o-linear-gradient(top, #292929, #191919);
background-image: linear-gradient(top, #292929, #191919);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0);
color: #fff;
}
.topbar div > ul .menu-dropdown .active a,
.nav .menu-dropdown .active a,
.topbar div > ul .dropdown-menu .active a,
.nav .dropdown-menu .active a {
color: #fff;
}
.topbar div > ul .menu-dropdown .divider,
.nav .menu-dropdown .divider,
.topbar div > ul .dropdown-menu .divider,
.nav .dropdown-menu .divider {
background-color: #222;
border-color: #444;
}
.topbar ul .menu-dropdown li a, .topbar ul .dropdown-menu li a {
padding: 4px 15px;
}
.topbar .dropdown-menu a, .dropdown-menu a {
display: block;
padding: 4px 15px;
clear: both;
font-weight: normal;
line-height: 18px;
color: #808080;
text-shadow: 0 1px 0 #fff;
}
.topbar .dropdown-menu a:hover,
.dropdown-menu a:hover,
.topbar .dropdown-menu a.hover,
.dropdown-menu a.hover {
background-color: #dddddd;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#eeeeee), to(#dddddd));
background-image: -moz-linear-gradient(top, #eeeeee, #dddddd);
background-image: -ms-linear-gradient(top, #eeeeee, #dddddd);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eeeeee), color-stop(100%, #dddddd));
background-image: -webkit-linear-gradient(top, #eeeeee, #dddddd);
background-image: -o-linear-gradient(top, #eeeeee, #dddddd);
background-image: linear-gradient(top, #eeeeee, #dddddd);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd', GradientType=0);
color: #404040;
text-decoration: none;
-webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025);
-moz-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025);
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery-ui
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code contained within the demos directory.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
All files located in the node_modules and external directories are
externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from
the terms above.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"name": "jquery-ui",
"title": "jQuery UI",
"description": "A curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.",
"version": "1.12.1",
"homepage": "http://jqueryui.com",
"author": {
"name": "jQuery Foundation and other contributors",
"url": "https://github.com/jquery/jquery-ui/blob/1.12.1/AUTHORS.txt"
},
"main": "ui/widget.js",
"maintainers": [
{
"name": "Scott González",
"email": "scott.gonzalez@gmail.com",
"url": "http://scottgonzalez.com"
},
{
"name": "Jörn Zaefferer",
"email": "joern.zaefferer@gmail.com",
"url": "http://bassistance.de"
},
{
"name": "Mike Sherov",
"email": "mike.sherov@gmail.com",
"url": "http://mike.sherov.com"
},
{
"name": "TJ VanToll",
"email": "tj.vantoll@gmail.com",
"url": "http://tjvantoll.com"
},
{
"name": "Felix Nagel",
"email": "info@felixnagel.com",
"url": "http://www.felixnagel.com"
},
{
"name": "Alex Schmitz",
"email": "arschmitz@gmail.com",
"url": "https://github.com/arschmitz"
}
],
"repository": {
"type": "git",
"url": "git://github.com/jquery/jquery-ui.git"
},
"bugs": "https://bugs.jqueryui.com/",
"license": "MIT",
"scripts": {
"test": "grunt"
},
"dependencies": {},
"devDependencies": {
"commitplease": "2.3.0",
"grunt": "0.4.5",
"grunt-bowercopy": "1.2.4",
"grunt-cli": "0.1.13",
"grunt-compare-size": "0.4.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-csslint": "0.5.0",
"grunt-contrib-jshint": "0.12.0",
"grunt-contrib-qunit": "1.0.1",
"grunt-contrib-requirejs": "0.4.4",
"grunt-contrib-uglify": "0.11.1",
"grunt-git-authors": "3.1.0",
"grunt-html": "6.0.0",
"grunt-jscs": "2.1.0",
"load-grunt-tasks": "3.4.0",
"rimraf": "2.5.1",
"testswarm": "1.1.0"
},
"keywords": []
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
dev_server_templates
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment