Skip to content

Commit

Permalink
Get the flask-security token from /api/me. Fixes an issue in the UI t…
Browse files Browse the repository at this point in the history
…hat broke 2FA.
  • Loading branch information
brian7704 committed Oct 16, 2024
1 parent d31ec3e commit 4c053ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions opentakserver/blueprints/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ def certificate():
@api_blueprint.route('/api/me')
@auth_required()
def me():
me = db.session.execute(db.session.query(User).where(User.id == current_user.id)).first()[0]
return jsonify(me.serialize())
# me = db.session.execute(db.session.query(User).where(User.id == current_user.id)).first()[0]
return jsonify(current_user.to_json())


@api_blueprint.route('/api/cot', methods=['GET'])
Expand Down
4 changes: 3 additions & 1 deletion opentakserver/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ def serialize(self):
}

def to_json(self):
return self.serialize()
response = self.serialize()
response['token'] = self.get_auth_token()
return response

0 comments on commit 4c053ff

Please sign in to comment.