diff --git a/litecord/blueprints/auth.py b/litecord/blueprints/auth.py index 8936c4c..3e5676e 100644 --- a/litecord/blueprints/auth.py +++ b/litecord/blueprints/auth.py @@ -5,6 +5,7 @@ import bcrypt from quart import Blueprint, jsonify, request, current_app as app from litecord.auth import token_check, create_user +from litecord.schemas import validate, REGISTER, REGISTER_WITH_INVITE bp = Blueprint('auth', __name__) @@ -47,6 +48,19 @@ async def register(): }) +@bp.route('/register_inv', methods=['POST']) +async def _register_with_invite(): + data = await request.form + + # dummy for now + print(data['username']) + print(data['email']) + print(data['password']) + print(data['invcode']) + + return 'dab', 200 + + @bp.route('/login', methods=['POST']) async def login(): j = await request.get_json() diff --git a/litecord/schemas.py b/litecord/schemas.py index 4a392d0..944f408 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -150,6 +150,16 @@ def validate(reqjson: Union[Dict, List], schema: Dict, return validator.document +REGISTER = { + 'email': {'type': 'email'}, + 'username': {'type': 'username'}, + 'password': {'type': 'string', 'minlength': 5} +} + +REGISTER_WITH_INVITE = {**REGISTER, **{ + 'invcode': {'type': 'string', 'required': True} +} + USER_UPDATE = { 'username': { 'type': 'username', 'minlength': 2, diff --git a/run.py b/run.py index 8953814..9fa703f 100644 --- a/run.py +++ b/run.py @@ -5,7 +5,7 @@ import asyncpg import logbook import logging import websockets -from quart import Quart, g, jsonify, request +from quart import Quart, g, jsonify, request, send_file from logbook import StreamHandler, Logger from logbook.compat import redirect_logging @@ -285,3 +285,9 @@ async def handle_500(err): async def index(): """sample index page.""" return 'hewwo' + + +@app.route('/register') +async def register_frontend(): + """basic register page.""" + return await send_file('static/invite_register.html') diff --git a/static/invite_register.html b/static/invite_register.html new file mode 100644 index 0000000..59d7854 --- /dev/null +++ b/static/invite_register.html @@ -0,0 +1,23 @@ + + +
+ + + +register
+ + + + +