diff --git a/auth-domain/user-manager/src/api/auth.py b/auth-domain/user-manager/src/api/auth.py index 594479c..a33575a 100644 --- a/auth-domain/user-manager/src/api/auth.py +++ b/auth-domain/user-manager/src/api/auth.py @@ -3,7 +3,7 @@ from flask import request from flask_restx import Namespace, Resource from src import bcrypt -from src.api.cruds.users import add_user, get_user_by_email, get_user_by_id +from src.api.cruds.users import get_user_by_email, get_user_by_id from src.api.models.users import User auth_namespace = Namespace("auth") @@ -19,25 +19,6 @@ parser = auth_namespace.parser() parser.add_argument("Authorization", location="headers") -class Register(Resource): - @auth_namespace.marshal_with(auth_user_model) - @auth_namespace.expect(auth_full_user_model, validate=True) - @auth_namespace.response(201, "Success") - @auth_namespace.response(400, "Sorry. That email already exists.") - def post(self): - post_data = request.get_json() - username = post_data.get("username") - email = post_data.get("email") - password = post_data.get("password") - - user = get_user_by_email(email) - if user: - auth_namespace.abort(400, "Sorry. That email already exists.") - user = add_user(username, email, password) - - return user, 201 - - class Login(Resource): @auth_namespace.marshal_with(auth_tokens_model) @auth_namespace.expect(auth_login_model, validate=True) @@ -124,7 +105,6 @@ class Status(Resource): auth_namespace.abort(403, "Token required") -auth_namespace.add_resource(Register, "/register") auth_namespace.add_resource(Login, "/login") auth_namespace.add_resource(Refresh, "/refresh") auth_namespace.add_resource(Status, "/status")