office auth
This commit is contained in:
@@ -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"])
|
||||
|
||||
Reference in New Issue
Block a user