This commit is contained in:
Maciej Mieszczyński 2018-12-12 11:41:11 +01:00
commit 9183d0b82c
22 changed files with 35431 additions and 0 deletions

View File

@ -0,0 +1,16 @@
System operacyjny Windows, 64-bit
1. Pobieramy poleceniem `git clone https://git.wmi.amu.edu.pl/s434576/WU.git` w folderze, do którego chcemy żeby repozytorium zostało sklonowane.
2. Instalujemy Pythona w wersji 3.6+.
3. Instalujemy framework webowy Flask poleceniem `pip install flask`.
OPCJONALNE 4. Instalujemy MySQLa dla Flaska poleceniem `pip install flask-mysql`.
OPCJONALNE 5. Instalujemy PonyORM poleceniem `pip install pony`.
OPCJONALNE 6. Instalujemy narzędzie CMake z tego linku: https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1-win64-x64.msi (wybieramy opcję dodania CMake do PATH).
OPCJONALNE 7. Instalujemy bibliotekę do rozpoznawania twarzy poleceniem `pip install face_recognition`.
8. Instalujemy bibliotekę OpenCV2 poleceniem `pip install opencv-python`.
OPCJONALNE 9. Pobieramy MySQL Installer w wersji 8.0+ (wybieramy Customową instalację: MySQL Server 8.0, Connector ODBC, Connector Python).
OPCJONALNE 10. Wybieramy hasło dla konta root: (w moim przypadku jest to "localhost", w innym przypadku trzeba w skrypcie zmienić w sekcji "MySQL configurations" na odpowiednie hasło).
OPCJONALNE 11. W MySQL Command Line Client wpisujemy hasło i wprowadzamy te polecenia: `CREATE DATABASE wu; use wu; CREATE TABLE Users(login VARCHAR(45) PRIMARY KEY, password VARCHAR(45), face VARCHAR(45));`
12. Będąc w folderze Python uruchamiamy skrypt poleceniem `python app.py`.
13. Zezwalamy na dostęp przez zaporę Pythonowi.
14. Wchodzimy w przeglądarce na http://127.0.0.1:5000/.

650
app.py Normal file
View File

@ -0,0 +1,650 @@
from flask import Flask, render_template, request, json, session, redirect, Blueprint, url_for
from flask_wtf import Form
from wtforms.fields import StringField, SubmitField
from wtforms.validators import Required
#from flaskext.mysql import MySQL
#from pony.orm import *
import cv2
import logging as log
import datetime as dt
from time import sleep
from flask_socketio import SocketIO
from flask_socketio import emit, join_room, leave_room
import smtplib
from oauth2client import file, client, tools
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
main = Blueprint('main', __name__)
app = Flask(__name__)
app.secret_key = '523tvb6h3nio6r21cc4r1qx'
app.debug = True
socketio = SocketIO()
app.register_blueprint(main)
socketio.init_app(app)
# MySQL configurations
#app.config['MYSQL_DATABASE_USER'] = 'root'
#app.config['MYSQL_DATABASE_PASSWORD'] = 'localhost'
#app.config['MYSQL_DATABASE_DB'] = 'wu'
#app.config['MYSQL_DATABASE_HOST'] = 'localhost'
#mysql = MySQL()
#mysql.init_app(app)
@app.route('/groupChat', methods=['GET', 'POST'])
def indexChat():
if "user" in session:
"""Login form to enter a room."""
form = LoginForm()
if form.validate_on_submit():
session['name'] = session["user"].split('@')[0] #form.name.data
session['room'] = "Czat grupowy" #form.room.data
return redirect(url_for('.chat'))
elif request.method == 'GET':
form.name.data = session.get('name', '')
form.room.data = session.get('room', '')
return render_template('indexChat.html', form=form)
else:
return render_template("error.html", error = "Brak dostępu!")
@app.route('/chat')
def chat():
if "user" in session:
"""Chat room. The user's name and room must be stored in
the session."""
name = session["user"] #session.get('name', '')
room = "Czat grupowy" #session.get('room', '')
if name == '' or room == '' or name == None:
return redirect("index.html")
return render_template('chat.html', name=name, room=room)
else:
return render_template("error.html", error = "Brak dostępu!")
@socketio.on('joined', namespace='/chat')
def joined(message):
"""Sent by clients when they enter a room.
A status message is broadcast to all people in the room."""
room = "Czat grupowy" #session.get('room')
join_room(room)
emit('status', {'msg': session.get('user').split('@')[0] + ' wszedł na czat'}, room=room)
@socketio.on('text', namespace='/chat')
def text(message):
"""Sent by a client when the user entered a new message.
The message is sent to all people in the room."""
room = "Czat grupowy" #session.get('room')
emit('message', {'msg': session.get('user').split('@')[0] + ':' + message['msg']}, room=room)
@socketio.on('left', namespace='/chat')
def left(message):
"""Sent by clients when they leave a room.
A status message is broadcast to all people in the room."""
room = "Czat grupowy" #session.get('room')
leave_room(room)
emit('status', {'msg': session.get('user').split('@')[0] + ' opuścił czat'}, room=room)
class LoginForm(Form):
"""Accepts a nickname and a room."""
name = StringField('Name', validators=[Required()])
room = StringField('Room', validators=[Required()])
submit = SubmitField('Wejdź na czat')
faces_list = []
testing_face = 0
service = None
SCOPES = "https://www.googleapis.com/auth/calendar.events"
@socketio.on('message')
def handleMessage(msg):
print('Message: ' + msg)
send(msg, broadcast=True)
@app.route("/")
def main():
store = file.Storage('token.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('credentials.json', SCOPES)
creds = tools.run_flow(flow, store)
service = build('calendar', 'v3', http=creds.authorize(Http()))
return render_template('index.html', info="Witaj!")
@app.route("/indexENG")
def indexENG():
return render_template('indexENG.html', info="Hello!")
@app.route('/showSignUp')
def showSignUp():
return render_template('signup.html')
@app.route('/showSignUpENG')
def showSignUpENG():
return render_template('signupENG.html')
@app.route('/showSignIn')
def showSignIn():
return render_template('signin.html')
@app.route('/showSignInENG')
def showSignInENG():
return render_template('signinENG.html')
@app.route('/signUp',methods=['POST','GET'])
def signUp():
try:
_login = request.form['inputLogin']
_password = request.form['inputPassword']
if _login and _password:
conn = mysql.connect()
cursor = conn.cursor()
#_hashed_password = generate_password_hash(_password)
args = (_login, _password)
cursor.execute("INSERT into Users(login, password) values(%s, %s)", args)
data = cursor.fetchall()
if len(data) is 0:
conn.commit()
return render_template("index.html", info="Pomyślnie zarejestrowano!")
#return json.dumps({'message':'User created successfully !'})
else:
return render_template("error.html", error="Użytkownik już istnieje!")
#return json.dumps({'error':str(data[0])})
else:
return json.dumps({'html':'<span>Enter the required fields</span>'})
#except Exception as e:
# return json.dumps({'error':str(e)})
finally:
cursor.close()
conn.close()
@app.route('/signUpENG',methods=['POST','GET'])
def signUpENG():
try:
_login = request.form['inputLogin']
_password = request.form['inputPassword']
if _login and _password:
conn = mysql.connect()
cursor = conn.cursor()
#_hashed_password = generate_password_hash(_password)
args = (_login, _password)
cursor.execute("INSERT into Users(login, password) values(%s, %s)", args)
data = cursor.fetchall()
if len(data) is 0:
conn.commit()
return render_template("indexENG.html", info="Successfully registered!")
#return json.dumps({'message':'User created successfully !'})
else:
return render_template("errorENG.html", error="The user already exists!")
#return json.dumps({'error':str(data[0])})
else:
return json.dumps({'html':'<span>Enter the required fields</span>'})
#except Exception as e:
# return json.dumps({'error':str(e)})
finally:
cursor.close()
conn.close()
@app.route('/validateLogin',methods=['POST'])
def validateLogin():
#con, cursor = None, None
#try:
#_username = request.form['inputLogin']
gmail_username = request.form['inputLogin']
#_password = request.form['inputPassword']
gmail_password = request.form['inputPassword']
try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(gmail_username, gmail_password)
if "@gmail.com" not in gmail_username:
session['user'] = gmail_username + "@gmail.com" #.split('@')[0]
else:
session["user"] = gmail_username
return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"))
except:
return render_template('error.html',error = 'Zły email lub hasło!')
'''
con = mysql.connect()
cursor = con.cursor()
#cursor.callproc('logowanie',(_username,))
args = (_username, _password)
query = "SELECT * from Users where login = %s and password = %s"
cursor.execute(query, args)
data = cursor.fetchall()
if len(data) > 0:
#if check_password_hash(str(data[0][3]),_password):
#if str(data[0][3]) == _password:
if str(data[0][1]) == _password:
session['user'] = data[0][0]
#return redirect('/userHome', user=session['user'])
return render_template('userHome.html', user=session['user'])
else:
return render_template('error.html',error = 'Zły email lub hasło!')
else:
return render_template('error.html',error = 'Zły email lub hasło!')
except Exception as e:
return render_template('error.html',error = str(e))
finally:
if cursor:
cursor.close()
if con:
con.close()
'''
@app.route('/validateLoginENG',methods=['POST'])
def validateLoginENG():
#con, cursor = None, None
#try:
#_username = request.form['inputLogin']
gmail_username = request.form['inputLogin']
#_password = request.form['inputPassword']
gmail_password = request.form['inputPassword']
try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(gmail_username, gmail_password)
session['user'] = gmail_username#.split('@')[0]
return render_template('userHomeENG.html', user=gmail_username.split('@')[0])
except:
return render_template('errorENG.html',error = 'Wrong email or password!')
'''
con = mysql.connect()
cursor = con.cursor()
#cursor.callproc('logowanie',(_username,))
args = (_username, _password)
query = "SELECT * from Users where login = %s and password = %s"
cursor.execute(query, args)
data = cursor.fetchall()
if len(data) > 0:
#if check_password_hash(str(data[0][3]),_password):
#if str(data[0][3]) == _password:
if str(data[0][1]) == _password:
session['user'] = data[0][0]
#return redirect('/userHomeENG', user=session['user'])
return render_template('userHomeENG.html', user=session['user'])
else:
return render_template('errorENG.html',error = 'Wrong email or password!')
else:
return render_template('errorENG.html',error = 'Wrong email or password!')
except Exception as e:
return render_template('errorENG.html', error = str(e))
finally:
if cursor:
cursor.close()
if con:
con.close()
'''
@app.route('/userHome')
def userHome():
if session.get('user'):
return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"))
else:
return render_template('error.html',error = 'Nieautoryzowany dostęp!')
@app.route('/userHomeENG')
def userHomeENG():
if session.get('user'):
return render_template('userHomeENG.html', user=session['user'].split('@')[0])
else:
return render_template('errorENG.html',error = 'Unauthorized access!')
@app.route('/logout')
def logout():
session.pop('user',None)
return redirect('/')
@app.route('/logoutENG')
def logoutENG():
session.pop('user',None)
return redirect('/indexENG')
@app.route('/signUpWithFace')
def signUpWithFace():
cascPath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
log.basicConfig(filename='webcam.log',level=log.INFO)
video_capture = cv2.VideoCapture(0)
anterior = 0
faces = None
i = 0
while True:
if not video_capture.isOpened():
print('Unable to load camera.')
sleep(5)
pass
# Capture frame-by-frame
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30)
)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
if anterior != len(faces):
anterior = len(faces)
log.info("faces: "+str(len(faces))+" at "+str(dt.datetime.now()))
# Display the resulting frame
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Display the resulting frame
cv2.imshow('Video', frame)
if type(faces) is not tuple:
i += 1
face = 0
for f in faces[0]:
face += f
faces_list.append(face)
if i == 5:
break
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
print (faces_list)
return render_template('index.html', info="Zapisano twarz")
@app.route('/signUpWithFaceENG')
def signUpWithFaceENG():
cascPath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
log.basicConfig(filename='webcam.log',level=log.INFO)
video_capture = cv2.VideoCapture(0)
anterior = 0
faces = None
i = 0
while True:
if not video_capture.isOpened():
print('Unable to load camera.')
sleep(5)
pass
# Capture frame-by-frame
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30)
)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
if anterior != len(faces):
anterior = len(faces)
log.info("faces: "+str(len(faces))+" at "+str(dt.datetime.now()))
# Display the resulting frame
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Display the resulting frame
cv2.imshow('Video', frame)
if type(faces) is not tuple:
i += 1
face = 0
for f in faces[0]:
face += f
faces_list.append(face)
if i == 5:
break
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
print (faces_list)
return render_template('indexENG.html', info="A face has been saved")
@app.route('/signInWithFace')
def signInWithFace():
cascPath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
log.basicConfig(filename='webcam.log',level=log.INFO)
video_capture = cv2.VideoCapture(0)
anterior = 0
faces = None
testing_face = 825
i = 0
while True:
if not video_capture.isOpened():
print('Unable to load camera.')
sleep(5)
pass
# Capture frame-by-frame
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30)
)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
if anterior != len(faces):
anterior = len(faces)
log.info("faces: "+str(len(faces))+" at "+str(dt.datetime.now()))
# Display the resulting frame
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Display the resulting frame
cv2.imshow('Video', frame)
#print (faces_list)
if type(faces) is not tuple:
face = 0
i += 1
for f in faces[0]:
face += f
if face in faces_list:
break
elif i == 20:
return render_template("error.html", error="Brak dostępu!")
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
return render_template('userHome.html', info="Zapisano twarz", user=session.get('user').split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"))
@app.route('/signInWithFaceENG')
def signInWithFaceENG():
cascPath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
log.basicConfig(filename='webcam.log',level=log.INFO)
video_capture = cv2.VideoCapture(0)
anterior = 0
faces = None
testing_face = 825
i = 0
while True:
if not video_capture.isOpened():
print('Unable to load camera.')
sleep(5)
pass
# Capture frame-by-frame
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30)
)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
if anterior != len(faces):
anterior = len(faces)
log.info("faces: "+str(len(faces))+" at "+str(dt.datetime.now()))
# Display the resulting frame
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Display the resulting frame
cv2.imshow('Video', frame)
#print (faces_list)
if type(faces) is not tuple:
face = 0
i += 1
for f in faces[0]:
face += f
if face in faces_list:
break
elif i == 20:
return render_template("errorENG.html", error="Lack of access!")
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
return render_template('userHomeENG.html', info="A face has been saved", user=session.get('user').split('@')[0])
@app.route('/addEvent', methods=['POST'])
def addEvent():
summary = request.form["inputSummary"]
location = request.form["inputLocation"]
description = request.form["inputDescription"]
description = request.form["inputDescription"]
description = request.form["inputDescription"]
start = request.form["inputStart"]
end = request.form["inputEnd"]
attendees = request.form["inputAttendees"].split(',')
processed_attendees = []
for attendee in attendees:
attendee = attendee.strip()
if "@gmail.com" not in attendee:
attendee += "@gmail.com"
processed_attendees.append({'email': attendee})
event = { 'summary': summary,
'location': location,
'description': description,
'start': {
'dateTime': start + ":00+01:00",
'timeZone': 'Europe/Warsaw'
},
'end': {
'dateTime': end + ":00+01:00",
'timeZone': 'Europe/Warsaw'
},
'attendees': processed_attendees
}
#credentials = ServiceAccountCredentials.from_json_keyfile_name(
# 'credentials.json',
# scopes="https://www.googleapis.com/auth/calendar.events")
#http = httplib2.Http()
#http = credentials.authorize(http)
#service = build("calendar", "v3", http=http)
#store = file.Storage('token.json')
#creds = store.get()
#if not creds or creds.invalid:
# flow = client.flow_from_clientsecrets('credentials.json', SCOPES)
# creds = tools.run_flow(flow, store)
#service = build('calendar', 'v3', http=creds.authorize(Http()))
store = file.Storage('token.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('credentials.json', "https://www.googleapis.com/auth/calendar.events")
creds = tools.run_flow(flow, store)
service = build('calendar', 'v3', http=creds.authorize(Http()))
service.events().insert(calendarId='primary', body=event).execute()
return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"))
@app.route('/toAddEvent')
def toAddEvent():
if session.get('user'):
return render_template('addEvent.html')
else:
return render_template('error.html',error = 'Nieautoryzowany dostęp!')
if __name__ == "__main__":
#app.run(host='0.0.0.0')
# Port: 5000
#socketio.run(app, debug=True)
socketio.run(app, host="0.0.0.0")#, ssl_context=("cert.pem", "key.pem"))

1
credentials.json Normal file
View File

@ -0,0 +1 @@
{"installed":{"client_id":"566304981572-9hr3g1k77etvjovjr4qbordioblum93q.apps.googleusercontent.com","project_id":"my-project-1544556068455","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://www.googleapis.com/oauth2/v3/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"4ym9H4hS-IURN5BhxytXzb6J","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}

File diff suppressed because it is too large Load Diff

73
static/calendar.css Normal file
View File

@ -0,0 +1,73 @@
ul {list-style-type: none;}
body {font-family: Verdana, sans-serif;}
/* Month header */
.month {
/*padding: 70px 25px;*/
width: 100%;
background: #1abc9c;
text-align: center;
}
/* Month list */
.month ul {
margin: 0;
padding: 0;
}
.month ul li {
color: white;
font-size: 20px;
text-transform: uppercase;
letter-spacing: 3px;
}
/* Previous button inside month header */
.month .prev {
float: left;
padding-top: 10px;
}
/* Next button */
.month .next {
float: right;
padding-top: 10px;
}
/* Weekdays (Mon-Sun) */
.weekdays {
margin: 0;
padding: 10px 0;
background-color:#ddd;
}
.weekdays li {
display: inline-block;
width: 13.6%;
color: #666;
text-align: center;
}
/* Days (1-30) */
.days {
padding: 10px 0;
background: cyan;
margin: 0;
}
.days li {
list-style-type: none;
display: inline-block;
width: 13.6%;
text-align: center;
margin-bottom: 5px;
font-size:12px;
color: #777;
}
/* Highlight the "current" day */
.days li .active {
padding: 5px;
background: #1abc9c;
color: white !important
}

5
static/js/jquery-1.12.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

73
static/signup.css Normal file
View File

@ -0,0 +1,73 @@
body {
padding-top: 40px;
padding-bottom: 40px;
}
.form-signin {
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
height: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
/*******************************************/
.form-signin2 {
max-width: 800px;
padding: 15px;
margin: 0 auto;
}
.form-control2 {
position: relative;
height: auto;
width: 120px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
.form-control3 {
position: relative;
height: auto;
width: 320px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
/************************************/
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
/*margin-bottom: -1px;*/
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

78
templates/addEvent.html Normal file
View File

@ -0,0 +1,78 @@
<!DOCTYPE html>
<!--<html lang="en">-->
<html lang="pl-PL">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/css/signup.css" rel="stylesheet">
<link rel="stylesheet" href="../static/css/calendar.css">
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<!--<form><input type="button" value="Back" onClick="history.go(-1);return true;"></form>-->
<!--<li role="presentation" class="active"><input type="button" value="Back" onClick="history.go(-1);return true;">
</li>-->
<!--<li role="presentation" class="active"><form action="http://google.com"><input type="button" value="Wstecz" onClick="history.go(-1);return true;"></form></li>-->
<!-- <li role="presentation" class="active"><a href="userHomeENG">ENG</a> -->
<!-- </li> -->
<li role="presentation" class="active"><a href="userHome">Wróć do strony domowej</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/logout">Wyloguj</a>
</li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron" style="height: 550px;">
<h2>Dodaj nowe wydarzenie do kalendarza</h2>
<div class="col-xs-12">
<form class="form-signin" action="/addEvent" method="post">
Nazwa:
<input type="text" name="inputSummary" id="inputSummary" class="form-control" placeholder="Wpisz nazwę" required autofocus/>
Lokalizacja:
<input type="text" name="inputLocation" id="inputLocation" class="form-control" placeholder="Wpisz lokalizację" required/>
Opis:
<input type="text" name="inputDescription" id="inputDescription" class="form-control" placeholder="Wpisz opis" required/>
Termin rozpoczęcia:
<input type="datetime-local" name="inputStart" id="inputStart" class="form-control" placeholder="Wpisz termin" required/>
Termin zakończenia:
<input type="datetime-local" name="inputEnd" id="inputEnd" class="form-control" placeholder="Wpisz termin" required/>
Uczestnicy:
<textarea type="text" name="inputAttendees" id="inputAttendees" class="form-control" placeholder="Podaj uczestników (ich adresy gmailowe) rozdzielając ich przecinkiem" required></textarea>
<div>
<input type="submit" value="Dodaj" style="margin-top: 5px; float: right;" class="btn btn-success"/></div>
</form>
</div>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

182
templates/chat.html Normal file
View File

@ -0,0 +1,182 @@
<!DOCTYPE html>
<!--<html lang="en">-->
<html lang="pl-PL">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/css/signup.css" rel="stylesheet">
<link rel="stylesheet" href="../static/css/calendar.css">
<style>
table, td, th {
border: 1px solid;
text-align: left;
}
table {
border-collapse: collapse;
/*width: 100%;*/
}
th, td {
padding: 5px;
}
ul {list-style-type: none;}
body {font-family: Verdana, sans-serif;}
/* Month header */
.month {
/*padding: 70px 25px;*/
width: 100%;
background: #1abc9c;
text-align: center;
}
/* Month list */
.month ul {
margin: 0;
padding: 0;
}
.month ul li {
color: white;
font-size: 20px;
text-transform: uppercase;
letter-spacing: 3px;
}
/* Previous button inside month header */
.month .prev {
float: left;
padding-top: 10px;
}
/* Next button */
.month .next {
float: right;
padding-top: 10px;
}
/* Weekdays (Mon-Sun) */
.weekdays {
margin: 0;
padding: 10px 0;
background-color:#ddd;
}
.weekdays li {
display: inline-block;
width: 13.6%;
color: #666;
text-align: center;
}
/* Days (1-30) */
.days {
padding: 10px 0;
background: cyan;
margin: 0;
}
.days li {
list-style-type: none;
display: inline-block;
width: 13.6%;
text-align: center;
margin-bottom: 5px;
font-size:12px;
color: #777;
}
/* Highlight the "current" day */
.days li .active {
padding: 5px;
background: #1abc9c;
color: white !important
}
</style>
<script type="text/javascript" src="//code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
var socket;
$(document).ready(function(){
socket = io.connect('http://' + document.domain + ':' + location.port + '/chat');
socket.on('connect', function() {
socket.emit('joined', {});
});
socket.on('status', function(data) {
$('#chat').val($('#chat').val() + '<' + data.msg + '>\n');
$('#chat').scrollTop($('#chat')[0].scrollHeight);
});
socket.on('message', function(data) {
if (data.msg != "") {
$('#chat').val($('#chat').val() + data.msg + '\n');
$('#chat').scrollTop($('#chat')[0].scrollHeight);
}
});
$('#text').keypress(function(e) {
var code = e.keyCode || e.which;
if (code == 13) {
text = $('#text').val();
$('#text').val('');
socket.emit('text', {msg: text});
}
});
});
function leave_room() {
socket.emit('left', {}, function() {
socket.disconnect();
// go back to the login page
window.location.href = "{{ url_for('userHome') }}";
});
}
</script>
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<!--<form><input type="button" value="Back" onClick="history.go(-1);return true;"></form>-->
<!--<li role="presentation" class="active"><input type="button" value="Back" onClick="history.go(-1);return true;">
</li>-->
<!--<li role="presentation" class="active"><form action="http://google.com"><input type="button" value="Wstecz" onClick="history.go(-1);return true;"></form></li>-->
<li role="presentation" class="active"><a href="/userHome">Wstecz</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/logout">Wyloguj</a>
</li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron" style="height: 550px;">
<h1>{{ room }}</h1>
<textarea readonly id="chat" cols="80" rows="15"></textarea><br><br>
<input id="text" size="80" placeholder="Tutaj wpisz swoją wiadomość"><br><br>
<a href="#" onclick="leave_room();" style="border:1px;">Wyjdź z czatu</a>
</div><footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</body>
</html>

51
templates/error.html Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="pl-PL">
<head>
<meta charset="UTF-8">
<title>Nieautoryzowany Dostęp:: Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="javascript:history.back()">Wstecz</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/">Strona główna</a>
</li>
<li role="presentation"><a href="/showSignIn">Zaloguj się</a>
</li>
<li role="presentation"><a href="/showSignUp">Zarejestruj się</a>
</li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron">
<h1>{{error}}</h1>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

51
templates/errorENG.html Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Unauthorized Access:: Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="javascript:history.back()">Back</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/">Home</a>
</li>
<li role="presentation"><a href="/showSignInENG">Sign in</a>
</li>
<li role="presentation"><a href="/showSignUpENG">Register</a>
</li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron">
<h1>{{error}}</h1>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

56
templates/index.html Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<!--<html lang="en">-->
<html lang="pl-PL">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="indexENG">ENG</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="#">Strona główna</a>
</li>
<li role="presentation"><a href="showSignIn">Zaloguj się</a>
</li>
<li role="presentation"><a href="showSignUp">Zarejestruj się</a>
</li>
</ul>
</nav>
<h3 class="text-muted">Python Flask</h3>
</div>
<div class="jumbotron">
<h1>Aplikacja Testowa</h1>
<p class="lead"></p>
<p><a class="btn btn-lg btn-success" href="showSignUp" role="button">Rejestracja</a>
</p>
<h2>{{ info }}</h2>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

14
templates/indexChat.html Normal file
View File

@ -0,0 +1,14 @@
<html>
<head>
<title>Czat grupowy</title>
</head>
<body>
<h1>Czat grupowy</h1>
<form method="POST">
{{ form.hidden_tag() }}
{{ form.name.label }}: {{ form.name() }} {% for error in form.name.errors %}{{ error }}{% endfor %}<br>
{{ form.room.label }}: {{ form.room() }} {% for error in form.room.errors %}{{ error }}{% endfor %}<br>
{{ form.submit() }}
</form>
</body>
</html>

55
templates/indexENG.html Normal file
View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="/">PL</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="#">Home</a>
</li>
<li role="presentation"><a href="showSignInENG">Sign in</a>
</li>
<li role="presentation"><a href="showSignUpENG">Register</a>
</li>
</ul>
</nav>
<h3 class="text-muted">Python Flask</h3>
</div>
<div class="jumbotron">
<h1>Test Application</h1>
<p class="lead"></p>
<p><a class="btn btn-lg btn-success" href="showSignUpENG" role="button">Registration</a>
</p>
<h2>{{ info }}</h2>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

78
templates/signin.html Normal file
View File

@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="pl-PL">
<!--html lang="en">-->
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/css/signup.css" rel="stylesheet">
<script src="../static/js/jquery-1.12.3.js"></script>
<!-- <script> -->
<!-- window.fbAsyncInit = function() { -->
<!-- FB.init({ -->
<!-- appId : '919664238236955', -->
<!-- autoLogAppEvents : true, -->
<!-- xfbml : true, -->
<!-- version : 'v3.2' -->
<!-- }); -->
<!-- }; -->
<!-- (function(d, s, id){ -->
<!-- var js, fjs = d.getElementsByTagName(s)[0]; -->
<!-- if (d.getElementById(id)) {return;} -->
<!-- js = d.createElement(s); js.id = id; -->
<!-- js.src = "https://connect.facebook.net/en_US/sdk.js"; -->
<!-- fjs.parentNode.insertBefore(js, fjs); -->
<!-- }(document, 'script', 'facebook-jssdk')); -->
<!-- </script> -->
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="javascript:history.back()">Wstecz</a>
</li>
<li role="presentation" class="active"><a href="showSignInENG">ENG</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" ><a href="/">Strona główna</a></li>
<li role="presentation" class="active"><a href="#">Zaloguj się</a></li>
<li role="presentation" ><a href="/showSignUp">Zarejestruj się</a></li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron">
<h1>Aplikacja Testowa</h1>
<form class="form-signin" action="/validateLogin" method="post">
<label for="inputLogin" class="sr-only">Nazwa użytkownika</label>
<input type="text" name="inputLogin" id="inputLogin" class="form-control" placeholder="Wpisz nazwę" required autofocus>
<label for="inputPassword" class="sr-only">Hasło</label>
<input type="password" name="inputPassword" id="inputPassword" class="form-control" placeholder="Wpisz hasło" required>
<input type="submit" value="Zaloguj się normalnie"></input>
<!-- <button id="btnSignIn" class="btn btn-lg btn-primary btn-block" type="submit">Potwierdź logowanie</button> -->
</form>
<form class="form-signin" action="/signInWithFace" method="get">
<input type="submit" value="Zaloguj się za pomocą twarzy"></input>
</form>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

60
templates/signinENG.html Normal file
View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/css/signup.css" rel="stylesheet">
<script src="../static/js/jquery-1.12.3.js"></script>
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="javascript:history.back()">Back</a>
</li>
<li role="presentation" class="active"><a href="showSignIn">PL</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" ><a href="/indexENG">Home</a></li>
<li role="presentation" class="active"><a href="#">SignIn</a></li>
<li role="presentation" ><a href="/showSignUpENG">Register</a></li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron">
<h1>Test Application</h1>
<form class="form-signin" action="/validateLoginENG" method="post">
<label for="inputLogin" class="sr-only">Login</label>
<input type="text" name="inputLogin" id="inputLogin" class="form-control" placeholder="Enter login" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="inputPassword" id="inputPassword" class="form-control" placeholder="Enter the password" required>
<input type="submit" value="Log in normally"></input>
<!-- <button id="btnSignIn" class="btn btn-lg btn-primary btn-block" type="submit">Potwierdź logowanie</button> -->
</form>
<form class="form-signin" action="/signInWithFaceENG" method="get">
<input type="submit" value="Log in with your face"></input>
</form>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

39
templates/signup.css Normal file
View File

@ -0,0 +1,39 @@
body {
padding-top: 40px;
padding-bottom: 40px;
}
.form-signin {
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
height: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

83
templates/signup.html Normal file
View File

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="pl-PL">
<!--html lang="en">-->
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/signup.css" rel="stylesheet">
<script src="../static/js/jquery-1.12.3.min.js"></script>
<!-- <script type="text/javascript"> -->
<!-- $(function() { -->
<!-- $('#btnSignUp').click(function() { -->
<!-- $.ajax({ -->
<!-- url: '/signUp', -->
<!-- data: $('form').serialize(), -->
<!-- type: 'POST', -->
<!-- success: function(response) { -->
<!-- console.log(response); -->
<!-- }, -->
<!-- error: function(error) { -->
<!-- console.log(error); -->
<!-- } -->
<!-- }); -->
<!-- }); -->
<!-- }); -->
<!-- </script> -->
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="javascript:history.back()">Wstecz</a>
</li>
<li role="presentation" class="active"><a href="showSignUpENG">ENG</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<!--<li role="presentation" ><a href="main">Strona główna</a></li>-->
<li role="presentation" ><a href="/">Strona główna</a></li>
<li role="presentation"><a href="/showSignIn">Zaloguj się</a></li>
<li role="presentation" class="active"><a href="#">Zarejestruj się</a></li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron">
<h1>Aplikacja Testowa</h1>
<form class="form-signin" action="/signUp" method="post">
<label for="inputLogin" class="sr-only">Login</label>
<input type="name" name="inputLogin" id="inputLogin" class="form-control" placeholder="Login" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="inputPassword" id="inputPassword" class="form-control" placeholder="Hasło" required>
<input type="submit" value="Zatwierdź"></input>
<!-- <button id="btnSignUp" class="btn btn-lg btn-primary btn-block" type="button">Potwierdź rejestrację</button> -->
</form>
<form class="form-signin" action="/signUpWithFace" method="get">
<input type="submit" value="Zatwierdź dane twarzy"></input>
<!-- <button id="btnSignUp" class="btn btn-lg btn-primary btn-block" type="button">Potwierdź rejestrację</button> -->
</form>
<!--<button id="btnSignUp" class="btn btn-lg btn-primary btn-block" type="button">Potwierdź rejestrację</button>-->
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

82
templates/signupENG.html Normal file
View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/signup.css" rel="stylesheet">
<script src="../static/js/jquery-1.12.3.min.js"></script>
<!-- <script type="text/javascript"> -->
<!-- $(function() { -->
<!-- $('#btnSignUp').click(function() { -->
<!-- $.ajax({ -->
<!-- url: '/signUp', -->
<!-- data: $('form').serialize(), -->
<!-- type: 'POST', -->
<!-- success: function(response) { -->
<!-- console.log(response); -->
<!-- }, -->
<!-- error: function(error) { -->
<!-- console.log(error); -->
<!-- } -->
<!-- }); -->
<!-- }); -->
<!-- }); -->
<!-- </script> -->
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<li role="presentation" class="active"><a href="javascript:history.back()">Back</a>
</li>
<li role="presentation" class="active"><a href="showSignUp">PL</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<!--<li role="presentation" ><a href="main">Strona główna</a></li>-->
<li role="presentation" ><a href="/indexENG">Home</a></li>
<li role="presentation"><a href="/showSignInENG">Sign in</a></li>
<li role="presentation" class="active"><a href="#">Register</a></li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron">
<h1>Test Application</h1>
<form class="form-signin" action="/signUpENG" method="post">
<label for="inputLogin" class="sr-only">Login</label>
<input type="name" name="inputLogin" id="inputLogin" class="form-control" placeholder="Login" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="inputPassword" id="inputPassword" class="form-control" placeholder="Password" required>
<input type="submit" value="Submit"></input>
<!-- <button id="btnSignUp" class="btn btn-lg btn-primary btn-block" type="button">Potwierdź rejestrację</button> -->
</form>
<form class="form-signin" action="/signUpWithFaceENG" method="get">
<input type="submit" value="Confirm the face data"></input>
<!-- <button id="btnSignUp" class="btn btn-lg btn-primary btn-block" type="button">Potwierdź rejestrację</button> -->
</form>
<!--<button id="btnSignUp" class="btn btn-lg btn-primary btn-block" type="button">Potwierdź rejestrację</button>-->
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

230
templates/userHome.html Normal file
View File

@ -0,0 +1,230 @@
<!DOCTYPE html>
<!--<html lang="en">-->
<html lang="pl-PL">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/css/signup.css" rel="stylesheet">
<link rel="stylesheet" href="../static/css/calendar.css">
<style>
table, td, th {
border: 1px solid;
text-align: left;
}
table {
border-collapse: collapse;
/*width: 100%;*/
}
th, td {
padding: 5px;
}
ul {list-style-type: none;}
body {font-family: Verdana, sans-serif;}
/* Month header */
.month {
/*padding: 70px 25px;*/
width: 100%;
background: #1abc9c;
text-align: center;
}
/* Month list */
.month ul {
margin: 0;
padding: 0;
}
.month ul li {
color: white;
font-size: 20px;
text-transform: uppercase;
letter-spacing: 3px;
}
/* Previous button inside month header */
.month .prev {
float: left;
padding-top: 10px;
}
/* Next button */
.month .next {
float: right;
padding-top: 10px;
}
/* Weekdays (Mon-Sun) */
.weekdays {
margin: 0;
padding: 10px 0;
background-color:#ddd;
}
.weekdays li {
display: inline-block;
width: 13.6%;
color: #666;
text-align: center;
}
/* Days (1-30) */
.days {
padding: 10px 0;
background: cyan;
margin: 0;
}
.days li {
list-style-type: none;
display: inline-block;
width: 13.6%;
text-align: center;
margin-bottom: 5px;
font-size:12px;
color: #777;
}
/* Highlight the "current" day */
.days li .active {
padding: 5px;
background: #1abc9c;
color: white !important
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<!--<form><input type="button" value="Back" onClick="history.go(-1);return true;"></form>-->
<!--<li role="presentation" class="active"><input type="button" value="Back" onClick="history.go(-1);return true;">
</li>-->
<!--<li role="presentation" class="active"><form action="http://google.com"><input type="button" value="Wstecz" onClick="history.go(-1);return true;"></form></li>-->
<li role="presentation" class="active"><a href="userHomeENG">ENG</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/logout">Wyloguj</a>
</li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron" style="height: 550px;">
<h1>Witaj w domu {{user}}!</h1>
<div class="col-xs-8">
<!-- <iframe src="https://calendar.google.com/calendar/embed?src=micik220@gmail.com" style="border-width:0" width="500" height="350" frameborder="0" scrolling="no"></iframe> -->
<iframe src="{{ calendar_src }}" style="border-width:0" width="500" height="350" frameborder="0" scrolling="no"></iframe>
<!-- <div class="month"> -->
<!-- <ul> -->
<!-- <li>Listopad<br><span style="font-size:18px">2018</span></li> -->
<!-- </ul> -->
<!-- </div> -->
<!-- <ul class="weekdays"> -->
<!-- <li>Cz</li> -->
<!-- <li>Pi</li> -->
<!-- <li>So</li> -->
<!-- <li>Ni</li> -->
<!-- <li>Po</li> -->
<!-- <li>Wt</li> -->
<!-- <li>Śr</li> -->
<!-- </ul> -->
<!-- <ul class="days"> -->
<!-- <li>1</li> -->
<!-- <li>2</li> -->
<!-- <li>3</li> -->
<!-- <li>4</li> -->
<!-- <li>5</li> -->
<!-- <li>6</li> -->
<!-- <li>7</li> -->
<!-- <li>8</li> -->
<!-- <li>9</li> -->
<!-- <li>10</li> -->
<!-- <li>11</li> -->
<!-- <li>12</li> -->
<!-- <li>13</li> -->
<!-- <li>14</li> -->
<!-- <li>15</li> -->
<!-- <li>16</li> -->
<!-- <li>17</li> -->
<!-- <li>18</li> -->
<!-- <li>19</li> -->
<!-- <li>20</li> -->
<!-- <li>21</li> -->
<!-- <li>22</li> -->
<!-- <li>23</li> -->
<!-- <li>24</li> -->
<!-- <li>25</li> -->
<!-- <li>26</li> -->
<!-- <li>27</li> -->
<!-- <li><span class="active">28</span></li> -->
<!-- <li>29</li> -->
<!-- <li>30</li> -->
<!-- </ul> -->
</div>
<p class="lead"></p>
<p>
<!-- <a class="btn btn-lg btn-success" href="#" role="button">Moje zajęcia</a> -->
<!-- <a class="btn btn-lg btn-success" href="#" role="button">Test</a> -->
<!-- <a class="btn btn-lg btn-success" href="#" role="button">Wyniki</a> -->
<a class="btn btn-lg btn-success" href="toAddEvent" role="button">Dodaj wydarzenie</a>
<a class="btn btn-lg btn-success" href="chat" role="button" style="margin-top:5px;">Czat grupowy</a>
<!-- <form action="ch"> -->
<!-- <input type="submit" value="Wejdź na czat grupowy" /> -->
<!-- </form> -->
</p>
<table>
<tr>
<th>Czas</th>
<th>Jaka aktywność</th>
</tr>
<tr>
<td>8:00</td>
<td>brak</td>
</tr>
<tr>
<td>9:00</td>
<td>brak</td>
</tr>
<tr>
<td>10:00</td>
<td>brak</td>
</tr>
<tr>
<td>11:00</td>
<td>brak</td>
</tr>
<tr>
<td>12:00</td>
<td>brak</td>
</tr>
</table>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

239
templates/userHomeENG.html Normal file
View File

@ -0,0 +1,239 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Python Flask App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="signup.css">
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<link href="../static/css/signup.css" rel="stylesheet">
<link rel="stylesheet" href="../static/css/calendar.css">
<style>
table, td, th {
border: 1px solid;
text-align: left;
}
table {
border-collapse: collapse;
/*width: 100%;*/
}
th, td {
padding: 5px;
}
ul {list-style-type: none;}
body {font-family: Verdana, sans-serif;}
/* Month header */
.month {
/*padding: 70px 25px;*/
width: 100%;
background: #1abc9c;
text-align: center;
}
/* Month list */
.month ul {
margin: 0;
padding: 0;
}
.month ul li {
color: white;
font-size: 20px;
text-transform: uppercase;
letter-spacing: 3px;
}
/* Previous button inside month header */
.month .prev {
float: left;
padding-top: 10px;
}
/* Next button */
.month .next {
float: right;
padding-top: 10px;
}
/* Weekdays (Mon-Sun) */
.weekdays {
margin: 0;
padding: 10px 0;
background-color:#ddd;
}
.weekdays li {
display: inline-block;
width: 13.6%;
color: #666;
text-align: center;
}
/* Days (1-30) */
.days {
padding: 10px 0;
background: cyan;
margin: 0;
}
.days li {
list-style-type: none;
display: inline-block;
width: 13.6%;
text-align: center;
margin-bottom: 5px;
font-size:12px;
color: #777;
}
/* Highlight the "current" day */
.days li .active {
padding: 5px;
background: #1abc9c;
color: white !important
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<nav>
<ul class="nav nav-pills pull-left">
<!--<form><input type="button" value="Back" onClick="history.go(-1);return true;"></form>-->
<!--<li role="presentation" class="active"><input type="button" value="Back" onClick="history.go(-1);return true;">
</li>-->
<!--<li role="presentation" class="active"><form action="http://google.com"><input type="button" value="Wstecz" onClick="history.go(-1);return true;"></form></li>-->
<li role="presentation" class="active"><a href="javascript:history.back()">Back</a>
</li>
<li role="presentation" class="active"><a href="userHome">PL</a>
</li>
</ul>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/logoutENG">Log out</a>
</li>
</ul>
</nav>
<h3 class="text-muted"><center>Python Flask</center></h3>
</div>
<div class="jumbotron" style="height: 550px;">
<h1>Welcome home {{user}}!</h1>
<div class="col-xs-8">
<div class="month">
<ul>
<li>November<br><span style="font-size:18px">2018</span></li>
</ul>
</div>
<ul class="weekdays">
<li>Th</li>
<li>Fr</li>
<li>Sa</li>
<li>Su</li>
<li>Mo</li>
<li>Tu</li>
<li>We</li>
</ul>
<ul class="days">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
<li>14</li>
<li>15</li>
<li>16</li>
<li>17</li>
<li>18</li>
<li>19</li>
<li>20</li>
<li>21</li>
<li>22</li>
<li>23</li>
<li>24</li>
<li>25</li>
<li>26</li>
<li>27</li>
<li><span class="active">28</span></li>
<li>29</li>
<li>30</li>
</ul>
</div>
<p class="lead"></p>
<p>
<a class="btn btn-lg btn-success" href="#" role="button">My lessons</a>
<a class="btn btn-lg btn-success" href="#" role="button">Test</a>
<a class="btn btn-lg btn-success" href="#" role="button">Results</a>
</p>
<table>
<tr>
<th>Time</th>
<th>What activity</th>
</tr>
<tr>
<td>8:00</td>
<td>nothing</td>
</tr>
<tr>
<td>9:00</td>
<td>nothing</td>
</tr>
<tr>
<td>10:00</td>
<td>nothing</td>
</tr>
<tr>
<td>11:00</td>
<td>nothing</td>
</tr>
<tr>
<td>12:00</td>
<td>nothing</td>
</tr>
<tr>
<td>13:00</td>
<td>nothing</td>
</tr>
<tr>
<td>14:00</td>
<td>nothing</td>
</tr>
<tr>
<td>15:00</td>
<td>nothing</td>
</tr>
<tr>
<td>16:00</td>
<td>nothing</td>
</tr>
</table>
</div>
<footer class="footer">
<p>&copy; UAM 2018</p>
</footer>
</div>
</body>
</html>

1
token.json Normal file
View File

@ -0,0 +1 @@
{"access_token": "ya29.GltvBjJUQJa7byeuf8v3JCkjwtevLdEkDEAxeXytM542WScD1GrhdCU7MI7lgx74qV3b_Q4S5D0nAK8PQnqEC9yiUsYt16-vXHZ0oyZd2I6jlQNtmr0yma8UkSpn", "client_id": "566304981572-9hr3g1k77etvjovjr4qbordioblum93q.apps.googleusercontent.com", "client_secret": "4ym9H4hS-IURN5BhxytXzb6J", "refresh_token": "1/me1ZoXCKxkQuOW00ZUc0pNsFCQ9bjVnpY7SuFsetBv7DiONcLVMEwgcbw830I542", "token_expiry": "2018-12-11T20:44:33Z", "token_uri": "https://www.googleapis.com/oauth2/v3/token", "user_agent": null, "revoke_uri": "https://oauth2.googleapis.com/revoke", "id_token": null, "id_token_jwt": null, "token_response": {"access_token": "ya29.GltvBjJUQJa7byeuf8v3JCkjwtevLdEkDEAxeXytM542WScD1GrhdCU7MI7lgx74qV3b_Q4S5D0nAK8PQnqEC9yiUsYt16-vXHZ0oyZd2I6jlQNtmr0yma8UkSpn", "expires_in": 3600, "refresh_token": "1/me1ZoXCKxkQuOW00ZUc0pNsFCQ9bjVnpY7SuFsetBv7DiONcLVMEwgcbw830I542", "scope": "https://www.googleapis.com/auth/calendar.events", "token_type": "Bearer"}, "scopes": ["https://www.googleapis.com/auth/calendar.events"], "token_info_uri": "https://oauth2.googleapis.com/tokeninfo", "invalid": false, "_class": "OAuth2Credentials", "_module": "oauth2client.client"}