readded fe

This commit is contained in:
2023-10-13 16:09:34 +02:00
parent 52664b7adb
commit 884ae00574
3 changed files with 11 additions and 10 deletions

View File

@@ -167,7 +167,7 @@ except requests.exceptions.ConnectionError as err:
# oidc_multi_auth = MultiAuth(oidc_auth, jwt_auth) <- can't work as OIDCAuthentication not implementing HTTPAuth # oidc_multi_auth = MultiAuth(oidc_auth, jwt_auth) <- can't work as OIDCAuthentication not implementing HTTPAuth
#from .serve_frontend import fe_bp from .serve_frontend import fe_bp
from .api import auth_api_bp, api_v1, api_bp from .api import auth_api_bp, api_v1, api_bp
CORS(app) CORS(app)
@@ -176,7 +176,7 @@ CORS(api_bp)
app.register_blueprint(auth_bp) app.register_blueprint(auth_bp)
app.register_blueprint(auth_api_bp) app.register_blueprint(auth_api_bp)
app.register_blueprint(api_bp) app.register_blueprint(api_bp)
#app.register_blueprint(fe_bp) app.register_blueprint(fe_bp)

View File

@@ -8,14 +8,14 @@ Login through API does not start a new session, but instead returns JWT.
from datetime import datetime from datetime import datetime
from pprint import pprint from pprint import pprint
from flask_jwt_extended import get_jwt_identity, jwt_required, current_user from flask_jwt_extended import get_jwt_identity, jwt_required, current_user, verify_jwt_in_request
from flask_restx import Resource, fields, inputs, abort from flask_restx import Resource, inputs, abort
from backend import db, app, jwt_auth from backend import db, app, jwt_auth
from backend.api import api_user from backend.api import api_user
from backend.api.models import user_model, recorder_model, generic_id_parser from backend.api.models import user_model, recorder_model, generic_id_parser
from backend.models import Recorder from backend.models.recorder_model import Recorder
from backend.models.user_model import User, Group from backend.models.user_model import User
user_update_parser = api_user.parser() user_update_parser = api_user.parser()
@@ -27,10 +27,11 @@ user_update_parser.add_argument('last_name', type=str, required=False, store_mis
@api_user.route('/profile') @api_user.route('/profile')
class Profile(Resource): class Profile(Resource):
@jwt_required @jwt_required()
@api_user.marshal_with(user_model) @api_user.marshal_with(user_model)
def get(self): def get(self):
"""Get infos about logged in user.""" """Get infos about logged in user."""
print("hey!")
current_user_id = get_jwt_identity() current_user_id = get_jwt_identity()
app.logger.info(current_user_id) app.logger.info(current_user_id)
return User.get_by_identifier(current_user_id) return User.get_by_identifier(current_user_id)
@@ -102,7 +103,7 @@ class UserList(Resource):
return User.get_all() return User.get_all()
@jwt_required @jwt_required
@api_user.doc('create_group') @api_user.doc('create_user')
@api_user.expect(user_model) @api_user.expect(user_model)
@api_user.marshal_with(user_model, code=201) @api_user.marshal_with(user_model, code=201)
def post(self): def post(self):

View File

@@ -16,8 +16,8 @@ if not os.path.exists(fe_path) or not os.path.exists(os.path.join(fe_path, "inde
app.logger.critical( app.logger.critical(
"Frontend path and/or index.html does not exist! Please build frontend before continuing! " "Frontend path and/or index.html does not exist! Please build frontend before continuing! "
"You might want to go to ../frontend and continue from there.") "You might want to go to ../frontend and continue from there.")
print("FATAL: Frontend path wrong or index.html missing -> EXITING!") print("ERROR: Frontend path wrong or index.html missing -> NO WEB-UI AVAILABLE!")
exit() #exit()
fe_bp = Blueprint('frontend', __name__, url_prefix='/', template_folder=os.path.join(fe_path, "")) fe_bp = Blueprint('frontend', __name__, url_prefix='/', template_folder=os.path.join(fe_path, ""))