From b5a26a58914d1396b068a6cd9ec0f2e285dfe911 Mon Sep 17 00:00:00 2001 From: Micik2 Date: Wed, 9 Jan 2019 12:48:07 +0100 Subject: [PATCH] WU-9 --- app.py | 354 +++++++++++++++++++++++++++++++----- camera.py | 24 +++ database.db | Bin 0 -> 36864 bytes templates/add_question.html | 166 +++++++++++++++++ templates/end_test.html | 158 ++++++++++++++++ templates/streaming.html | 148 +++++++++++++++ templates/test.html | 166 +++++++++++++++++ templates/userHome.html | 21 ++- 8 files changed, 987 insertions(+), 50 deletions(-) create mode 100644 camera.py create mode 100644 database.db create mode 100644 templates/add_question.html create mode 100644 templates/end_test.html create mode 100644 templates/streaming.html create mode 100644 templates/test.html diff --git a/app.py b/app.py index 45d9bc4..a2fc81c 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, request, json, session, redirect, Blueprint, url_for, flash, Response, send_from_directory +from flask import Flask, render_template, request, json, session, redirect, Blueprint, url_for, flash, Response, send_from_directory, stream_with_context, g from flask_wtf import Form from wtforms.fields import StringField, SubmitField from wtforms.validators import Required @@ -18,8 +18,13 @@ from httplib2 import Http from oauth2client.service_account import ServiceAccountCredentials import os from werkzeug.utils import secure_filename -# from camera import VideoCamera - +from camera import VideoCamera +import pyaudio +import sqlite3 +from flask_mail import Mail, Message +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.header import Header main = Blueprint('main', __name__) @@ -31,6 +36,18 @@ socketio = SocketIO() app.register_blueprint(main) socketio.init_app(app) +me = "wirtualna.uczelnia.2018@gmail.com" +my_password = "korniszon" + + +app.config.update(MAIL_SERVER = "smtp.gmail.com", + MAIL_PORT = 465, + MAIL_USE_SSL = True, + MAIL_USERNAME = "wirtualna.uczelnia.2018@gmail.com", + MAIL_PASSWORD = "korniszon") + +mail = Mail(app) + # MySQL configurations #app.config['MYSQL_DATABASE_USER'] = 'root' #app.config['MYSQL_DATABASE_PASSWORD'] = 'localhost' @@ -43,6 +60,10 @@ UPLOAD_FOLDER = './uploads' ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER +DATABASE = 'database.db' + +# connection = sqlite3.connect(DATABASE, isolation_level = None) + def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS @@ -167,8 +188,8 @@ def signUp(): cursor = conn.cursor() #_hashed_password = generate_password_hash(_password) - args = (_login, _password) - cursor.execute("INSERT into Users(login, password) values(%s, %s)", args) + args = (_login, _password,) + cursor.execute("INSERT into Users(login, password) values(?, ?)", args) data = cursor.fetchall() if len(data) is 0: @@ -198,8 +219,8 @@ def signUpENG(): cursor = conn.cursor() #_hashed_password = generate_password_hash(_password) - args = (_login, _password) - cursor.execute("INSERT into Users(login, password) values(%s, %s)", args) + args = (_login, _password,) + cursor.execute("INSERT into Users(login, password) values(?, ?)", args) data = cursor.fetchall() if len(data) is 0: @@ -236,40 +257,31 @@ def validateLogin(): 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: + if "wirtualna.uczelnia.2018" in gmail_username: + session["role"] = "admin" + else: + session["role"] = "user" + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cursor = cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='tests'") + results = cursor.fetchall() + if results is not None and session["role"] == "admin" and len(results) != 0: + cursor = cur.execute("SELECT title from tests") + results = cursor.fetchone() + if results is not None and len(results) != 0: + test = True + else: + test = False + else: + test = False + connection.close() + return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = test) + # else: + # return render_template('error.html',error = 'Zły email lub hasło!') + except smtplib.SMTPAuthenticationError: 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(): @@ -286,7 +298,7 @@ def validateLoginENG(): server.ehlo() server.login(gmail_username, gmail_password) session['user'] = gmail_username#.split('@')[0] - return render_template('userHomeENG.html', user=gmail_username.split('@')[0]) + return render_template('userHomeENG.html', user=gmail_username.split('@')[0], test = False) except: return render_template('errorENG.html',error = 'Wrong email or password!') @@ -295,7 +307,7 @@ def validateLoginENG(): cursor = con.cursor() #cursor.callproc('logowanie',(_username,)) args = (_username, _password) - query = "SELECT * from Users where login = %s and password = %s" + query = "SELECT * from Users where login = ? and password = ?" cursor.execute(query, args) data = cursor.fetchall() @@ -323,20 +335,30 @@ def validateLoginENG(): @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")) + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cursor = cur.execute("SELECT title from tests") + results = cursor.fetchall() + connection.close() + if len(results) != 0: + test = True + else: + test = False + return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = test) 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]) + return render_template('userHomeENG.html', user=session['user'].split('@')[0], test = False) else: return render_template('errorENG.html',error = 'Unauthorized access!') @app.route('/logout') def logout(): - session.pop('user',None) + session.pop('user', None) + session.pop('role', None) return redirect('/') @app.route('/logoutENG') @@ -533,7 +555,21 @@ def signInWithFace(): # 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")) + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cursor = cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='tests") + results = cursor.fetchall() + connection.close() + if len(results) != 0: + cursor = cur.execute("SELECT title from tests") + results = cursor.fetchone() + if len(results) != 0: + test = True + else: + test = False + else: + test = False + 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"), test = test) @app.route('/signInWithFaceENG') def signInWithFaceENG(): @@ -599,7 +635,7 @@ def signInWithFaceENG(): # 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]) + return render_template('userHomeENG.html', info="A face has been saved", user=session.get('user').split('@')[0], test = False) @app.route('/addEvent', methods=['POST']) def addEvent(): @@ -654,7 +690,21 @@ def addEvent(): 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")) + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cursor = cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='tests") + results = cursor.fetchall() + connection.close() + if len(results) != 0: + cursor = cur.execute("SELECT title from tests") + results = cursor.fetchone() + if len(results) != 0: + test = True + else: + test = False + else: + test = False + return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = test) @app.route('/streaming') def streaming(): @@ -733,7 +783,21 @@ def resources(): #file = request.form["fileToUpload"] filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) - return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user")) + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cursor = cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='tests") + results = cursor.fetchall() + connection.close() + if len(results) != 0: + cursor = cur.execute("SELECT title from tests") + results = cursor.fetchone() + if len(results) != 0: + test = True + else: + test = False + else: + test = False + return render_template('userHome.html', user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = False) else: return redirect(url_for('toResources')) @@ -834,9 +898,201 @@ def downloadResource(): else: return render_template('error.html',error = 'Nieautoryzowany dostęp!') ''' - + + +@app.route('/create_test', methods = ["GET", "POST"]) +def create_test(): + if session["role"] == "admin": + test_name = request.form["inputTestName"] + users = request.form["inputUsers"] + splitted_users = users.split(",") + emails = [] + for splitted_user in splitted_users: + if "@gmail.com" not in splitted_user: + emails.append(splitted_user.strip() + "@gmail.com") + else: + emails.append(splitted_user.strip()) + # msg = Message("Zostałeś przydzielony do nowego testu", + # sender = "wirtualna.uczelnia.2018@gmail.com", + # recipients = emails) + print(users) + # msg.body = "Link do testu:\n" + "http://150.254.78.161:5000/solve_test/1" + # msg.body = "Pojawił się nowy test, zaloguj się i go rozwiąż:\n" + "http://150.254.78.161:5000/showSignIn" + # msg = MIMEMultipart('alternative') + # msg.set_charset('utf8') + # msg['Subject'] = Header("Zostałeś przydzielony do nowego testu", "utf-8") + # msg['From'] = me + # html = "Pojawił się nowy test, zaloguj się i go rozwiąż:\n" + "http://150.254.78.161:5000/showSignIn" + # part2 = MIMEText(html, 'html', _charset="UTF-8") + # msg.attach(part2) + # s = smtplib.SMTP_SSL('smtp.gmail.com') + # s.login(me, my_password) + # for email in emails: + # msg['To'] = email + # s.sendmail(me, email, msg.as_string()) + # mail.send(msg) + msg = mail.send_message( + 'Zostałeś przydzielony do nowego testu', + sender='wirtualna.uczelnia.2018@gmail.com', + recipients=emails, + body="Pojawił się nowy test, zaloguj się i go rozwiąż:\n" + "http://150.254.78.161:5000/showSignIn" + ) + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cur.execute('DROP TABLE IF EXISTS tests') + cur.execute('DROP TABLE IF EXISTS questions') + cur.execute('DROP TABLE IF EXISTS users') + cur.execute('DROP TABLE IF EXISTS results') + cur.execute('CREATE TABLE tests (title TEXT PRIMARY KEY)') + cur.execute('CREATE TABLE users (nickname TEXT PRIMARY KEY)') + cur.execute('CREATE TABLE questions (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, answer_a TEXT, answer_b TEXT, answer_c TEXT, answer_d TEXT, correct_answer TEXT)') + cur.execute('CREATE TABLE results (nickname TEXT PRIMARY KEY, points INTEGER)') + print (test_name) + cur.execute('INSERT INTO tests(title) values(?)', (test_name,)) + for splitted_user in splitted_users: + user = splitted_user.split("@") + cur.execute('INSERT INTO users values(?)', (user[0].strip(),)) + cursor = cur.execute('SELECT * from tests') + connection.close() + # return render_template("add_question.html", test_title = test_name) + return redirect("show_test_owner") + else: + return render_template("error.html", error = "Brak dostępu!") + +@app.route("/show_test_owner") +def show_test_owner(): + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cursor = cur.execute("SELECT title from tests") + test_name = cursor.fetchone() + connection.close() + return render_template("add_question.html", test_title = test_name[0]) + +@app.route('/add_question', methods = ["POST"]) +def add_question(): + if session["role"] == "admin": + if request.form["submit"] == "Dodaj kolejne pytanie": + name = request.form["inputTitle"] + answer_a = request.form["inputA"] + answer_b = request.form["inputB"] + answer_c = request.form["inputC"] + answer_d = request.form["inputD"] + correct_answer = request.form["inputCorrect"] + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cur.execute("INSERT INTO questions(title, answer_a, answer_b, answer_c, answer_d, correct_answer) values(?, ?, ?, ?, ?, ?)", (name, answer_a, answer_b, answer_c, answer_d, correct_answer,)) + connection.close() + return redirect("show_test_owner") + elif request.form["submit"] == "Zatwierdź test": + name = request.form["inputTitle"] + answer_a = request.form["inputA"] + answer_b = request.form["inputB"] + answer_c = request.form["inputC"] + answer_d = request.form["inputD"] + correct_answer = request.form["inputCorrect"] + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + print (name) + # print (answer_a) + # print (correct_answer) + cursor = cur.execute("INSERT INTO questions(title, answer_a, answer_b, answer_c, answer_d, correct_answer) values(?, ?, ?, ?, ?, ?)", (name, answer_a, answer_b, answer_c, answer_d, correct_answer,)) + cursor = cur.execute("SELECT * from questions") + print (cursor.fetchone()) + # print (cursor) + # connection.close() + return render_template("userHome.html", user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = True) + else: + return render_template("error.html", error = "Brak dostępu!") + +@app.route("/show_test", methods = ["GET", "POST"]) +def show_test(): + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + cursor = cur.execute("SELECT nickname from results") + users = cursor.fetchall() + # if session["user"] + "@gmail.com" in users: + print (users) + if (session["user"].split("@")[0],) not in users: + cursor = cur.execute("SELECT * from questions") + questions = cursor.fetchall() + print (questions) + cursor = cur.execute("SELECT title from tests") + title = cursor.fetchone() + print (title) + connection.close() + return render_template("test.html", questions = questions, test = title[0]) + else: + return render_template("error.html", error = "Nie możesz wypełnić tego testu!") + + +@app.route("/test", methods = ["POST"]) +def test(): + # if session["role"] == "admin": + # return render_template("end_test_owner.html") + # if session["user"] in users: + if session["role"] == "user": + points = 0 + answers = [] + connection = sqlite3.connect('database.db', isolation_level = None) + cursor = connection.execute('SELECT correct_answer from questions') + correct_answers = cursor.fetchall() + for i in range(len(correct_answers)): + answers.append(request.form["inputAnswer"+str(i)]) + print (correct_answers) + for j in range(len(correct_answers)): + if answers[j] == correct_answers[j][0]: + points += 1 + cursor.execute("INSERT INTO results values(?, ?)", (session["user"].split("@")[0], points)) + connection.close() + if points == 1: + sentence = "punkt" + elif points == 2 or points == 3 or points == 4: + sentence = "punkty" + elif points > 4 or points == 0: + sentence = "punktów" + return render_template("userHome.html", user=session['user'].split('@')[0] + ". Twój wynik wyniósł " + str(points) + sentence, calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = False) + + # if answer == correct_answer: + # cursor = connection.execute('SELECT points from results where nickname = ?', session["user"]) + # points = cursor.fetchone() + # connection.execute('UPDATE TABLE results SET points = ?', points + 1) + # connection.close() + # if question_number != count_questions: + # return redirect(url_for("solve_test", question_number + 1)) + # else: + # return render_template("end_test.html", points = points) + else: + return render_template("error.html", error = "Brak dostępu!") + +@app.route("/end_test", methods = ["GET", "POST"]) +def end_test(): + connection = sqlite3.connect('database.db', isolation_level = None) + cur = connection.cursor() + if session["role"] == "admin": + cursor = cur.execute('SELECT MAX(points), nickname from results group by nickname') + results = cursor.fetchall() + cur.execute('DROP TABLE IF EXISTS tests') + cur.execute('DROP TABLE IF EXISTS questions') + cur.execute('DROP TABLE IF EXISTS users') + cur.execute('DROP TABLE IF EXISTS results') + connection.close() + if len(results) != 0: + print (results) + if results[0][0] == 1: + sentence = "punkt, a uzyskał go: " + elif results[0][0] == 2 or results[0][0] == 3 or results[0][0] == 4: + sentence = "punkty, a uzyskał go: " + elif results[0][0] > 4 or results[0][0] == 0: + sentence = "punktów, a uzyskał go: " + return render_template("userHome.html", user=session['user'].split('@')[0] + "\nNajlepszy wynik z ostatniego testu wyniósł " + str(results[0][0]) + sentence + str(results[0][1]), calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = False) + else: + return render_template("userHome.html", user=session['user'].split('@')[0], calendar_src="https://calendar.google.com/calendar/embed?src=" + session.get("user"), test = False) + else: + return render_template("error.html", error = "Brak dostępu!") + 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")) + diff --git a/camera.py b/camera.py new file mode 100644 index 0000000..c2cfeac --- /dev/null +++ b/camera.py @@ -0,0 +1,24 @@ +import cv2 + +class VideoCamera(object): + def __init__(self): + # Using OpenCV to capture from device 0. If you have trouble capturing + # from a webcam, comment the line below out and use a video file + # instead. + self.video = cv2.VideoCapture(0) + # If you decide to use video.mp4, you must have this file in the folder + # as the main.py. + # self.video = cv2.VideoCapture('video.mp4') + + def __del__(self): + self.video.release() + + def get_frame(self): + success, image = self.video.read() + # We are using Motion JPEG, but OpenCV defaults to capture raw images, + # so we must encode it into JPEG in order to correctly display the + # video stream. + if cv2.waitKey(1) & 0xFF == ord('q'): + return + ret, jpeg = cv2.imencode('.jpg', image) + return jpeg.tobytes() \ No newline at end of file diff --git a/database.db b/database.db new file mode 100644 index 0000000000000000000000000000000000000000..002b6c262c74599f232c05b1c093cdaecdf28165 GIT binary patch literal 36864 zcmeI*-)qxA0KoA}>-uB0tuRJ}QFeQgmd#=3vtV>VhFhJrf zr4+(i5kh2DxS>K?3D)@LX7_S^nZ-;d&;8%F1e%;UQ2G+fzm9&NkwyjYfl1G!ae zxKG@=+^uizIQ2dG)ZLTL%f_>%TzNDm=w`4_V3iBVkmvK)FHe@)e_s5#=7 zt2AEUOxsIK)~CE_vgb$rb{q|(>_ij8LRk)j)}g+?>GHVLntay{!Z;c!R_^9gwzFi3 zAUyEj54-5~V|9_rH-|TDR)>kCdbob+2W&H&vTfT6OqcqR-;2y?ZlXJ;=!(u%D)TA( zfqhxyrh2n#qLga$qi)zqn}%Da;aEL4kvSzM8a73;{P!^!C#Y01SG8*DHmfGmbNY;K zHLrqI{4Lan0|5jOKmY**5I_I{1Q0*~0R;Xtfs~b4)Ncaj)wrzUPoX|~tzW+r&~GH> zR2Z%Ot0V^k2q1s}0tg_000IagfB*sr%$h(hS;}^TR&cnnac|gnJ?BrTaB=>xw?%Lu zfB*srAbEr{lZ#os{y*6NZ`S{3bR={e0R#|0009ILKmY**5I_I{ z1f~hhTZz(W{eNu#|FlafLjVB;5I_I{1Q0*~0R#|00D&157~lV|*Z$Sjdc!%mNj|0E6)BSqlZw}`FXQFs^eaAx25I_I{ c1Q0*~0R#|0009ILK;WMRa#pgG8U6nM9|8mykN^Mx literal 0 HcmV?d00001 diff --git a/templates/add_question.html b/templates/add_question.html new file mode 100644 index 0000000..2201741 --- /dev/null +++ b/templates/add_question.html @@ -0,0 +1,166 @@ + + + + + + + Python Flask App + + + + + + + + + + + + + + +
+
+ +

Python Flask

+
+ +
+

{{test_title}}

+

+

+ + + +

+ + + +

+
+ + + + +
+

© UAM 2018

+
+ +
+ + + \ No newline at end of file diff --git a/templates/end_test.html b/templates/end_test.html new file mode 100644 index 0000000..7c397a3 --- /dev/null +++ b/templates/end_test.html @@ -0,0 +1,158 @@ + + + + + + + Python Flask App + + + + + + + + + + + + + + +
+
+ +

Python Flask

+
+ +
+

Witaj w domu {{user}}!

+

+

+ + + + Twój wynik to {{points}} punktów. + + + + + + + +

+
+ + + + +
+

© UAM 2018

+
+ +
+ + + \ No newline at end of file diff --git a/templates/streaming.html b/templates/streaming.html new file mode 100644 index 0000000..5473adc --- /dev/null +++ b/templates/streaming.html @@ -0,0 +1,148 @@ + + + + + + + Python Flask App + + + + + + + + + + + + + + +
+
+ +

Python Flask

+
+ +
+

Witaj w domu {{user}}!

+
+ +
+

+
+ + + + +
+

© UAM 2018

+
+ +
+ + + \ No newline at end of file diff --git a/templates/test.html b/templates/test.html new file mode 100644 index 0000000..da1fa14 --- /dev/null +++ b/templates/test.html @@ -0,0 +1,166 @@ + + + + + + + Python Flask App + + + + + + + + + + + + + + +
+
+ +

Python Flask

+
+ +
+

{{test}}

+ +
+ + + + +
+

© UAM 2018

+
+ +
+ + + \ No newline at end of file diff --git a/templates/userHome.html b/templates/userHome.html index 9f97de8..de7ad47 100644 --- a/templates/userHome.html +++ b/templates/userHome.html @@ -133,6 +133,7 @@ body {font-family: Verdana, sans-serif;} +

@@ -142,11 +143,29 @@ body {font-family: Verdana, sans-serif;} Czat grupowy Podejrzyj materiały - + Uruchom testowy stream + {% if session['role'] == 'admin' %} + {% if test %} +

+ {% else %} + + {% endif %} + {% elif session['role'] == 'user' %} + + {% endif %}

+