This repository was archived by the owner on Jan 31, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55"""
66import os
77import datetime
8- from flask import request , jsonify
8+ from bson import json_util
9+ from flask import request , jsonify , Response
910from flask_restful import Api
1011from flask_jwt_simple import JWTManager , create_jwt
1112from .resources .device import Device
@@ -44,13 +45,18 @@ def auth():
4445 if not password :
4546 return jsonify ({"msg" : "Missing password parameter" }), 400
4647 if 'auth' in scope .keys ():
47- if not scope ["auth" ].login (username , password ):
48+ authr = scope ["auth" ].login (username , password )
49+ if not authr :
4850 return jsonify ({"msg" : "Bad username or password" }), 401
4951 else :
5052 if username != 'admin' or password == 'admin' :
5153 return jsonify ({"msg" : "Bad username or password" }), 401
52-
53- return jsonify ({'jwt' : create_jwt (identity = username )}), 200
54+ res = authr or {}
55+ res ["jwt" ] = create_jwt (identity = username )
56+ return Response (
57+ json_util .dumps (res ),
58+ mimetype = 'application/json'
59+ ), 200
5460
5561 # RESTFul API Routes definition
5662 api = Api (app )
Original file line number Diff line number Diff line change 44"""
55
66script_name = 'libfreeiot'
7- __version__ = '0.9.14 '
7+ __version__ = '0.9.15 '
You can’t perform that action at this time.
0 commit comments