office auth

This commit is contained in:
CHIEFSOFT\ameye
2025-07-21 06:19:06 -04:00
parent 9710390254
commit 45e7d64963
3 changed files with 96 additions and 1 deletions
+25
View File
@@ -14,6 +14,7 @@ from app.api.services import (
AuthorizationService,
MyProductsService,
ContactService,
OfficeAuthService
)
from app.utils.logger import logger
from app.api.middlewares import enforce_json, require_auth
@@ -195,6 +196,30 @@ def test_check():
#response = ProductsService.process_request(data)
return {"status": "ok"}, 200
#======================================================
@api.route('/office/login', methods=['POST'])
def login():
data = request.get_json()
# Check if username and password are provided
if not data or 'username' not in data or 'password' not in data:
return jsonify({
'error': 'Missing credentials',
'message': 'Username and password are required'
}), 400
username = data.get('username', '')
password = data.get('password', '')
# Call the login method from AuthService
result = OfficeAuthService.login(username, password)
# Check if result is a tuple (error response)
if isinstance(result, tuple):
return jsonify(result[0]), result[1]
return jsonify(result)
#=====================================================
# # EligibilityCheck Endpoint
# @api.route("/EligibilityCheck", methods=["POST"])