Skip to content

Commit

Permalink
adicionando loading page para o professor ver! ainda não está terminado
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaDaCosta committed Jan 31, 2024
1 parent 4eb1ea4 commit 45e34e7
Show file tree
Hide file tree
Showing 12 changed files with 573 additions and 807 deletions.
54 changes: 38 additions & 16 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions LOADINGPAGE/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
from flask import Flask, render_template,redirect,request,flash
import pyrebase



IMAG= Flask(__name__)
IMAG.config['SECRET_KEY']="IMAGSEGURA"
IMAG.secret_key='IMAGSEGURA'
config={
"apiKey": "AIzaSyAp_EOqeRaq3iC_Dtp9G4hqIdrq8hG3F0E",
"authDomain": "imag-v.firebaseapp.com",
"projectId": "imag-v",
"storageBucket": "imag-v.appspot.com",
"messagingSenderId": "424004884593",
"appId": "1:424004884593:web:3d829541de9a226286a3d0",
"measurementId": "G-T298S5NJQR",
"databaseURL":'https://imag-v-default-rtdb.firebaseio.com/'
}
firebase=pyrebase.initialize_app(config)
auth=firebase.auth()
print(config['databaseURL'])
# IMAG.secret_key='IMAGSEGURA'
# config={
# "apiKey": "AIzaSyAp_EOqeRaq3iC_Dtp9G4hqIdrq8hG3F0E",
# "authDomain": "imag-v.firebaseapp.com",
# "projectId": "imag-v",
# "storageBucket": "imag-v.appspot.com",
# "messagingSenderId": "424004884593",
# "appId": "1:424004884593:web:3d829541de9a226286a3d0",
# "measurementId": "G-T298S5NJQR",
# "databaseURL":'https://imag-v-default-rtdb.firebaseio.com/'
# }
# firebase=pyrebase.initialize_app(config)
# auth=firebase.auth()
# print(config['databaseURL'])
from LOADINGPAGE.controllers import default
Binary file modified LOADINGPAGE/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified LOADINGPAGE/controllers/__pycache__/default.cpython-39.pyc
Binary file not shown.
250 changes: 126 additions & 124 deletions LOADINGPAGE/controllers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,130 +8,132 @@
@IMAG.route('/home')
@IMAG.route('/')
def home():

return render_template('index.html')

@IMAG.route('/criar', methods=['POST', 'GET'])
def criar():
if request.method=='POST':
global nomecompleto, emailc, senhac, id_user,n,dic
nomecompleto = request.form.get("nome").strip()
emailc = request.form.get("email")
senhac = request.form.get("passe")
n = nomecompleto.split()
requisicaog = requests.get(f"{config['databaseURL']}/IMAG/ENTIDADES/.json")
dic = requisicaog.json()
for entidade in dic:
# print(entidade)
for u in dic[entidade]:
id_user=u



try:
dados = {
'INFORMACAO PESSOAL': {
'NOME COMPLETO': nomecompleto,
'EMAIL': emailc,
'SENHA':senhac
}
}
user = auth.create_user_with_email_and_password(emailc, senhac)
requisicaop = requests.post(f"{config['databaseURL']}/IMAG/ENTIDADES/ALUNO/.json", data=json.dumps(dados))
session['user']=emailc
return abort(404,erro)
except:
return redirect('/perguntas')
return render_template('criar.html')

@IMAG.route('/perguntas')
def pergunta():
if ('user' in session):
for entidade in dic:
# print(entidade)
for id in dic[entidade]:
for info in dic[entidade][id]:
info = dic[entidade][id]
nomedicl = info['INFORMACAO PESSOAL']['NOME COMPLETO']
emaildicl = info['INFORMACAO PESSOAL']['EMAIL']

n = nomedicl.split()
return redirect(f'/app/aluno/{n[0]}{n[len(n) - 1]}')
return render_template('perguntas.html')

@IMAG.route('/login', methods=['POST', 'GET'])
def login():
# if ('user' in session):
# return f'online {session["user"]}'
if request.method == 'POST':
emaill=request.form.get('email-lg')
senhal=request.form.get('passe-lg')
requisicaog = requests.get(f"{config['databaseURL']}/IMAG/ENTIDADES/.json")
dic = requisicaog.json()

for entidade in dic:
# print(entidade)
for id in dic[entidade]:
for info in dic[entidade][id]:
info = dic[entidade][id]
nomedicl = info['INFORMACAO PESSOAL']['NOME COMPLETO']
emaildicl = info['INFORMACAO PESSOAL']['EMAIL']

n = nomedicl.split()
try:
if emaill==emaildicl:
user = auth.sign_in_with_email_and_password(emaill, senhal)
session['user']=emaildicl
return abort(404, erro)
except:
return redirect(f'/app/aluno/{n[0]}{n[len(n) - 1]}')
return render_template('login.html')

@IMAG.route('/logout')
def logout():
session.pop('user')
return redirect('/')


@IMAG.route('/app')
def app(entidade,user):
e=entidade.lower()
user=user.lower()
requisicaog = requests.get(f"{config['databaseURL']}/IMAG/ENTIDADES/.json")
dic = requisicaog.json()
if ('user' in session):
if user in dic:
return render_template('appentidades.html', entidade=e, user=user, id=id)
else:
abort(404,'erro')
if not('user' in session):
return """
<style>
body{
display:flex;
justify-content:center;
align-items:center;
}
#error{
background:#1A4E69;
color:#BB6763;
border-radius:20px;
padding:10px;
font-size:20px;
}
a{
text-decoration:none;
color:#1A4E69;
background:#BB6763;
border-radius:20px;
padding:10px;
}
</style>
<title>IMAG ! ERROR </title>
<h1 id="error"> precisa-se de fazer o <a href='/login'>login</a> se não tiver nenhuma conta pode se cadastrar <a id="criar" href='/criar'>criar</a></h1>"""


IMAG.add_url_rule("/app/<entidade>/<user>/",view_func=app, endpoint='users')
# @IMAG.route('/criar', methods=['POST', 'GET'])
# def criar():
# if request.method=='POST':
# global nomecompleto, emailc, senhac, id_user,n,dic
# nomecompleto = request.form.get("nome").strip()
# emailc = request.form.get("email")
# senhac = request.form.get("passe")
# n = nomecompleto.split()
# requisicaog = requests.get(f"{config['databaseURL']}/IMAG/ENTIDADES/.json")
# dic = requisicaog.json()
# for entidade in dic:
# # print(entidade)
# for u in dic[entidade]:
# id_user=u
#
#
#
# try:
# dados = {
# 'INFORMACAO PESSOAL': {
# 'NOME COMPLETO': nomecompleto,
# 'EMAIL': emailc,
# 'SENHA':senhac
# }
# }
# user = auth.create_user_with_email_and_password(emailc, senhac)
# requisicaop = requests.post(f"{config['databaseURL']}/IMAG/ENTIDADES/ALUNO/.json", data=json.dumps(dados))
# session['user']=emailc
# return abort(404,erro)
# except:
# return redirect('/perguntas')
# return render_template('criar.html')
#
# @IMAG.route('/perguntas')
# def pergunta():
# if ('user' in session):
# for entidade in dic:
# # print(entidade)
# for id in dic[entidade]:
# for info in dic[entidade][id]:
# info = dic[entidade][id]
# nomedicl = info['INFORMACAO PESSOAL']['NOME COMPLETO']
# emaildicl = info['INFORMACAO PESSOAL']['EMAIL']
#
# n = nomedicl.split()
# return redirect(f'/app/aluno/{n[0]}{n[len(n) - 1]}')
# return render_template('perguntas.html')
#
# @IMAG.route('/login', methods=['POST', 'GET'])
# def login():
# # if ('user' in session):
# # return f'online {session["user"]}'
# if request.method == 'POST':
# emaill=request.form.get('email-lg')
# senhal=request.form.get('passe-lg')
# requisicaog = requests.get(f"{config['databaseURL']}/IMAG/ENTIDADES/.json")
# dic = requisicaog.json()
#
# for entidade in dic:
# # print(entidade)
# for id in dic[entidade]:
# for info in dic[entidade][id]:
# info = dic[entidade][id]
# nomedicl = info['INFORMACAO PESSOAL']['NOME COMPLETO']
# emaildicl = info['INFORMACAO PESSOAL']['EMAIL']
#
# n = nomedicl.split()
# try:
# if emaill==emaildicl:
# user = auth.sign_in_with_email_and_password(emaill, senhal)
# session['user']=emaildicl
# return abort(404, erro)
# except:
# return redirect(f'/app/aluno/{n[0]}{n[len(n) - 1]}')
# return render_template('login.html')
#
# @IMAG.route('/logout')
# def logout():
# session.pop('user')
# return redirect('/')
#
#
# @IMAG.route('/app')
# def app(entidade,user):
# e=entidade.lower()
# user=user.lower()
# requisicaog = requests.get(f"{config['databaseURL']}/IMAG/ENTIDADES/.json")
# dic = requisicaog.json()
# if ('user' in session):
# if user in dic:
# return render_template('appentidades.html', entidade=e, user=user, id=id)
# else:
# abort(404,'erro')
# if not('user' in session):
# return """
# <style>
#
# body{
# display:flex;
# justify-content:center;
# align-items:center;
# }
# #error{
# background:#1A4E69;
# color:#BB6763;
# border-radius:20px;
# padding:10px;
# font-size:20px;
#
# }
# a{
# text-decoration:none;
# color:#1A4E69;
# background:#BB6763;
# border-radius:20px;
# padding:10px;
# }
#
#
# </style>
# <title>IMAG ! ERROR </title>
# <h1 id="error"> precisa-se de fazer o <a href='/login'>login</a> se não tiver nenhuma conta pode se cadastrar <a id="criar" href='/criar'>criar</a></h1>"""
#
#
# IMAG.add_url_rule("/app/<entidade>/<user>/",view_func=app, endpoint='users')
Binary file not shown.
Loading

0 comments on commit 45e34e7

Please sign in to comment.