Commit 7d256ef0 authored by Jeff MrBE4R's avatar Jeff MrBE4R
Browse files

second commit

parent 19d3d158
from sqlalchemy import create_engine
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
#SECRET_KEY = os.urandom(32)
SECRET_KEY = "123456789"
DBUSER = 'birdsc'
DBPASSWORD = 'birdsc'
DBNAME = 'birdsc'
DBHOST = '127.0.0.1'
SQLALCHEMY_DATABASE_URI = 'postgresql://' + DBUSER + ':' + DBPASSWORD + '@' + DBHOST + '/' + DBNAME
THREADED = True
APP_NAME = 'BiRD - Summer School GRIOTE'
APP_VERSION = 'v0.1a'
LOG_FILE = 'birdsc.log'
try:
engine = create_engine(SQLALCHEMY_DATABASE_URI)
conn = engine.connect()
except:
import sys, traceback
print(sys.exc_info())
print(traceback.print_stack())
pass
class ProductionConfig(Config):
DEBUG = False
class DevelopmentConfig(Config):
DEVELOPMENT = True
DEBUG = True
\ No newline at end of file
from flask import Flask, redirect, url_for, session, request, render_template, render_template_string
from sqlalchemy import select, and_
import config
import hashlib
import database
app = Flask(__name__)
app.config.from_object(config.ProductionConfig)
@app.route('/')
def home_page():
if 'logged_in' in session:
return render_template('home.html', APP_NAME=config.Config.APP_NAME, APP_VERSION=config.Config.APP_VERSION)
else:
return redirect(url_for('login'))
@app.route('/login', methods=['GET', 'POST'])
def login():
if 'logged_in' in session:
return redirect(url_for('dashboard'))
else:
error = None
if request.method == 'POST':
s = select(
[
database.users.c.id,
database.users.c.login,
database.users.c.fullname,
database.users.c.email,
]
).where(
and_(
database.users.c.login == request.form['username'],
database.users.c.password == hashlib.sha256(request.form['password'].encode()).hexdigest()
)
)
account = ''
for row in config.Config.conn.execute(s):
account = row
if len(account) == 0:
error = 'Invalid credentials'
else:
session['logged_in'] = True
session['userid'] = str(account['id'])
session['login'] = str(account['login'])
session['fullname'] = str(account['fullname'])
session['email'] = str(account['email'])
return redirect(url_for('home_page'))
return render_template('login.html', APP_NAME=config.Config.APP_NAME, APP_VERSION=config.Config.APP_VERSION, error=error)
@app.route('/logout')
def logout():
session.pop('logged_in', None)
session.clear()
return redirect(url_for('home_page'))
@app.route('/classroom')
def classroom():
if 'logged_in' in session:
return render_template('console.html', APP_NAME=config.Config.APP_NAME, APP_VERSION=config.Config.APP_VERSION, instance_uid="")
else:
return redirect(url_for('login'))
@app.route('/install')
def install():
database.createTables()
database.createBaseUsers()
if __name__=='__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
\ No newline at end of file
from config import Config
import hashlib
from sqlalchemy import Column, String, Integer, DateTime, Boolean, MetaData, Table
def createTables():
try:
metadata.create_all(Config.engine)
except:
import sys, traceback
print(str(traceback.format_exc()))
print(str(sys.exc_info()))
def createBaseUsers():
try:
Config.conn.execute(
users.insert().values(
login='admin',
password=hashlib.sha256('admin'.encode()).hexdigest(),
fullname='Admin',
email='admin@localhost.localdomain.tld',
)
)
except:
import sys, traceback
print(str(traceback.format_exc()))
print(str(sys.exc_info()))
metadata = MetaData()
users = Table('users', metadata,
Column('id', Integer, primary_key=True),
Column('login', String(), nullable=False),
Column('password', String(), nullable=False),
Column('fullname', String()),
Column('email', String()),
Column('enabled', Boolean, nullable=False, default=False),
)
\ No newline at end of file
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
\ No newline at end of file
/*
HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
This diff is collapsed.
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
* */
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
\ No newline at end of file
body { font-family: sans-serif; height: 100%; height: 98.7vh; width: 99.9vw; width: 100%; }
h1, h2 { font-family: 'Georgia', serif; margin: 0; }
h1 { border-bottom: 2px solid #eee; }
h2 { font-size: 1.2em; }
a { text-decoration: none; }
.page { margin: 2em auto; width: 35em; border: 5px solid #ccc;
padding: 0.8em; background: white; }
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { margin: 0.8em 1.2em; }
.entries li h2 { margin-left: -1em; }
.add-entry { font-size: 0.9em; border-bottom: 1px solid #ccc; }
.add-entry dl { font-weight: bold; }
.metanav { text-align: right; font-size: 0.8em; padding: 0.3em;
margin-bottom: 1em; background: #fafafa; }
.flash { background: #cee5F5; padding: 0.5em;
border: 1px solid #aacbe2; }
.error { background: #f0d6d6; padding: 0.5em; }
#content-wrapper {
display: inline-block;
float: left;
width: 100%;
}
table {
width: 100%;
max-height: 100%;
margin: 0;
padding: 0;
border-collapse: collapse;
border-spacing: 0;
float: left;
text-align: center;
}
#page-wrapper{
margin: 0 0 0 70px;
margin-top: 52px;
}
.navbar-fixed-top{ background-color: #e3e4e6; }
.sidebar { width: 70px; }
.sidebar a { color: #000; }
.sidebar a i { color: #FF0000; }
.navbar-top-links .dropdown-menu li a i { color: #FF0000; }
.navbar-right a { color: #000; }
.panel-body { color:#000; }
.navbar-default .navbar-brand { color:#000; }
\ No newline at end of file
{
"name": "startbootstrap-sb-admin-2",
"version": "1.0.4",
"homepage": "http://startbootstrap.com/template-overviews/sb-admin-2/",
"authors": [
"David Miller"
],
"description": "A free, open source, Bootstrap admin theme created by Start Bootstrap",
"keywords": [
"bootstrap",
"theme"
],
"license": "Apache",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"pages",
"index.html",
"/js"
],
"main": [
"dist/css/sb-admin-2.css",
"dist/js/sb-admin-2.js"
],
"dependencies": {
"bootstrap": "~3.3.1",
"datatables": "~1.10.4",
"datatables-plugins": "~1.0.1",
"flot": "~0.8.3",
"font-awesome": "~4.2.0",
"holderjs": "~2.4.1",
"metisMenu": "~1.1.3",
"morrisjs": "~0.5.1",
"datatables-responsive": "~1.0.3",
"bootstrap-social": "~4.8.0",
"flot.tooltip": "~0.8.4"
}
}
{
"name": "bootstrap-social",
"main": "bootstrap-social.css",
"licence": "MIT",
"ignore": [
"assets",
"index.html",
"LICENCE"
],
"dependencies": {
"bootstrap": "~3",
"font-awesome": "~4.2"
},
"homepage": "https://github.com/lipis/bootstrap-social",
"version": "4.8.0",
"_release": "4.8.0",
"_resolution": {
"type": "version",
"tag": "4.8.0",
"commit": "918fc55c3c938377a7618ec0f115846e50d4b883"
},
"_source": "git://github.com/lipis/bootstrap-social.git",
"_target": "~4.8.0",
"_originalSource": "bootstrap-social",
"_direct": true
}
\ No newline at end of file
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Social Buttons for Bootstrap
============================
Social Buttons made in pure CSS based on
[Bootstrap](http://twbs.github.io/bootstrap/) and
[Font Awesome](http://fortawesome.github.io/Font-Awesome/)!
[Check the live demo!](http://lipis.github.io/bootstrap-social)
Installation
------------
Include the `bootstrap-social.css` or `bootstrap-social.less` in your project, or
install it through [Bower](http://bower.io/):
bower install bootstrap-social
Available classes
-----------------
- `btn-adn`
- `btn-bitbucket`
- `btn-dropbox`
- `btn-facebook`
- `btn-flickr`
- `btn-foursquare`
- `btn-github`
- `btn-google-plus`
- `btn-instagram`
- `btn-linkedin`
- `btn-microsoft`
- `btn-openid`
- `btn-reddit`
- `btn-soundcloud`
- `btn-tumblr`
- `btn-twitter`
- `btn-vimeo`
- `btn-vk`
- `btn-yahoo`
Examples
--------
```html
<a class="btn btn-block btn-social btn-twitter">
<i class="fa fa-twitter"></i>
Sign in with Twitter
</a>
<a class="btn btn-social-icon btn-twitter">
<i class="fa fa-twitter"></i>
</a>
```
Pull Requests
-------------
If you are about to create a new **Pull Request** for adding a new button don't
update the minified `bootstrap-social.css` file. It will be generated
automatically after a successful merge.
/*
* Social Buttons for Bootstrap
*
* Copyright 2013-2014 Panayiotis Lipiridis
* Licensed under the MIT License
*
* https://github.com/lipis/bootstrap-social
*/
@bs-height-base: (@line-height-computed + @padding-base-vertical * 2);
@bs-height-lg: (floor(@font-size-large * @line-height-base) + @padding-large-vertical * 2);
@bs-height-sm: (floor(@font-size-small * 1.5) + @padding-small-vertical * 2);
@bs-height-xs: (floor(@font-size-small * 1.2) + @padding-small-vertical + 1);
.btn-social {
position: relative;
padding-left: (@bs-height-base + @padding-base-horizontal);
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
> :first-child {
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: @bs-height-base;
line-height: (@bs-height-base + 2);
font-size: 1.6em;
text-align: center;
border-right: 1px solid rgba(0, 0, 0, 0.2);
}
&.btn-lg {
padding-left: (@bs-height-lg + @padding-large-horizontal);
:first-child {
line-height: @bs-height-lg;
width: @bs-height-lg;
font-size: 1.8em;
}
}
&.btn-sm {
padding-left: (@bs-height-sm + @padding-small-horizontal);
:first-child {
line-height: @bs-height-sm;
width: @bs-height-sm;
font-size: 1.4em;
}
}
&.btn-xs {
padding-left: (@bs-height-xs + @padding-small-horizontal);
:first-child {
line-height: @bs-height-xs;
width: @bs-height-xs;
font-size: 1.2em;
}
}
}
.btn-social-icon {
.btn-social;
height: (@bs-height-base + 2);
width: (@bs-height-base + 2);
padding: 0;
:first-child {
border: none;
text-align: center;
width: 100%!important;
}
&.btn-lg {
height: @bs-height-lg;
width: @bs-height-lg;
padding-left: 0;
padding-right: 0;
}
&.btn-sm {
height: (@bs-height-sm + 2);
width: (@bs-height-sm + 2);
padding-left: 0;
padding-right: 0;
}
&.btn-xs {
height: (@bs-height-xs + 2);
width: (@bs-height-xs + 2);
padding-left: 0;
padding-right: 0;
}
}
.btn-social(@color-bg, @color: #fff) {
background-color: @color-bg;
.button-variant(@color, @color-bg, rgba(0,0,0,.2));
}
.btn-adn { .btn-social(#d87a68); }
.btn-bitbucket { .btn-social(#205081); }
.btn-dropbox { .btn-social(#1087dd); }
.btn-facebook { .btn-social(#3b5998); }
.btn-flickr { .btn-social(#ff0084); }
.btn-foursquare { .btn-social(#f94877); }
.btn-github { .btn-social(#444444); }
.btn-google-plus { .btn-social(#dd4b39); }
.btn-instagram { .btn-social(#3f729b); }
.btn-linkedin { .btn-social(#007bb6); }
.btn-microsoft { .btn-social(#2672ec); }
.btn-openid { .btn-social(#f7931e); }
.btn-pinterest { .btn-social(#cb2027); }
.btn-reddit { .btn-social(#eff7ff, #000); }
.btn-soundcloud { .btn-social(#ff5500); }
.btn-tumblr { .btn-social(#2c4762); }
.btn-twitter { .btn-social(#55acee); }
.btn-vimeo { .btn-social(#1ab7ea); }
.btn-vk { .btn-social(#587ea3); }
.btn-yahoo { .btn-social(#720e9e); }
/*
* Social Buttons for Bootstrap
*
* Copyright 2013-2014 Panayiotis Lipiridis
* Licensed under the MIT License
*
* https://github.com/lipis/bootstrap-social
*/
$bs-height-base: ($line-height-computed + $padding-base-vertical * 2);
$bs-height-lg: (floor($font-size-large * $line-height-base) + $padding-large-vertical * 2);
$bs-height-sm: (floor($font-size-small * 1.5) + $padding-small-vertical * 2);
$bs-height-xs: (floor($font-size-small * 1.2) + $padding-small-vertical + 1);
.btn-social {
position: relative;
padding-left: ($bs-height-base + $padding-base-horizontal);
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
> :first-child {
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: $bs-height-base;
line-height: ($bs-height-base + 2);
font-size: 1.6em;
text-align: center;
border-right: 1px solid rgba(0, 0, 0, 0.2);
}
&.btn-lg {
padding-left: ($bs-height-lg + $padding-large-horizontal);
:first-child {
line-height: $bs-height-lg;
width: $bs-height-lg;