it's alivegit add .

master
kirbylife 2023-07-14 00:17:02 -06:00
parent ab74ca205a
commit f713a1de34
3 changed files with 52 additions and 8 deletions

View File

@ -1,9 +1,21 @@
import os import os
from dotenv import load_dotenv
__ALREADY_IMPORTED = False
if not __ALREADY_IMPORTED:
load_dotenv()
__ALREADY_IMPORTED = True
class Config(object): class Config(object):
if not os.getenv("secret_key"):
raise Exception("Must be setted the 'secret_key' env var")
SECRET_KEY=os.getenv("secret_key") SECRET_KEY=os.getenv("secret_key")
class DevelopmentConfig(Config): class DevelopmentConfig(Config):
DEBUG=True DEBUG=True
if not os.getenv("sql_uri"):
raise Exception("Must be setted the 'sql_url' env var")
SQLALCHEMY_DATABASE_URI = os.getenv("sql_uri") SQLALCHEMY_DATABASE_URI = os.getenv("sql_uri")
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False

View File

@ -4,7 +4,7 @@ from wtforms import Form
from wtforms import StringField from wtforms import StringField
from wtforms import PasswordField from wtforms import PasswordField
from wtforms import validators from wtforms import validators
from wtforms.fields.html5 import EmailField from wtforms import EmailField
import requests import requests
import re import re
@ -26,24 +26,24 @@ class LoginForm(Form):
validators.DataRequired("Ingrese un nombre de usuario o #WCA-ID"), validators.DataRequired("Ingrese un nombre de usuario o #WCA-ID"),
validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido") validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido")
]) ])
password = PasswordField(u"Contraseña *", password = PasswordField("Contraseña *",
[ [
validators.required(u"Ingrese su contraseña") validators.DataRequired("Ingrese su contraseña")
]) ])
class SignupForm(Form): class SignupForm(Form):
username = StringField(u"Nombre de usuario *", username = StringField("Nombre de usuario *",
[ [
validators.DataRequired("Este campo es requerido"), validators.DataRequired("Este campo es requerido"),
validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido") validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido")
]) ])
wcaId = StringField(u"#WCA-ID",[ wcaId = StringField("#WCA-ID",[
validateWCAID validateWCAID
]) ])
email = EmailField(u"Correo electronico *",[ email = EmailField("Correo electronico *",[
validators.DataRequired("Este campo es requerido"), validators.DataRequired("Este campo es requerido"),
validators.Email("Introduce una direccion de email valida") validators.Email("Introduce una direccion de email valida")
]) ])
password = PasswordField(u"Contraseña *",[ password = PasswordField("Contraseña *",[
validators.DataRequired("Este campo es requerido") validators.DataRequired("Este campo es requerido")
]) ])

32
pyproject.toml 100644
View File

@ -0,0 +1,32 @@
[tool.poetry]
name = "tptimer"
version = "0.1.0"
description = ""
authors = ["A social network to speedcubers"]
license = "Apache 2.0"
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
Flask = "^2.3.2"
Flask-WTF = "^1.1.1"
pyTwistyScrambler = "^1.6"
WTForms = "^3.0.1"
Flask-SQLAlchemy = "^3.0.5"
Werkzeug = "^2.3.6"
wtforms-html5 = "^0.6.1"
requests = "^2.31.0"
email-validator = "^2.0.0.post2"
python-dotenv = "^1.0.0"
pysqlite3 = "^0.5.1"
[tool.poetry.group.dev.dependencies]
ipython = "^8.14.0"
pytest = "^7.4.0"
[tool.poetry.scripts]
server = "app:main"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"