Questions tagged [flask-security]

Flask-Security is a Flask extension which adds basic security and authentication features to your Flask apps quickly and easily. It additionally bootstraps your application with various views for handling its configured features to get you up and running as quick as possible.

319 questions
1
vote
2 answers

Flask unittest and flask security too issue

i have simple Flask app with flask security too and some unittest. test.py: class UserModelCase(unittest.TestCase): def setUp(self): self.app = create_app(TestConfig) self.app_context = self.app.app_context() self.app_context.push() …
1
vote
1 answer

Flask-Security: How to get / list / print all roles for a given user

I want to list all roles a given user has. I'm not looking for current_user nor has_role. The idea is to make an 'edituser.html' where an admin can change/add/remove roles for a given user. For that use case I need to show what roles the user to be…
aquatic7
  • 615
  • 1
  • 6
  • 19
1
vote
1 answer

Show flask security roles in jinja2

I've created roles and assigned the to users. I can show the current logged in users name with {{current_user}} in jinja2. How do I show a users role(s) in jinja2? For example: Hi {{current_user}}, you have the roles: {{roles}}
aquatic7
  • 615
  • 1
  • 6
  • 19
1
vote
1 answer

Flask-admin with mongoengine show roles as 'Role object' instead of the respective role name

I am using flask-security and is now adding flask-admin. I have my user view and my roles view. I can create users and roles. But the roles don't show as the respective role names in the user dropdown menu. All roles just shows as "Role object". I…
aquatic7
  • 615
  • 1
  • 6
  • 19
1
vote
0 answers

Issue getting current_user object from flask_security in SocketIO Event

As the title says I have been trying to reference the current_user object in a SocketIO event as seen below: class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(255), unique=True) …
1
vote
0 answers

Flask security roles throwing mapping error

I am trying to build role based permission for my application. I am using flask security. I am stuck and bulding the data and relationship models for the application. Here is a snippet of the code: roles_users= db.Table('roles_users', …
bsam
  • 53
  • 1
  • 4
1
vote
1 answer

socket with python flask and ajax call

I have scenario where I want to use sockets to wrap my API calls and not available to hit directly the api in browser and get data. index.html : Report
John
  • 147
  • 1
  • 10
1
vote
2 answers

Flask-Security AttributeError: 'NoneType' object has no attribute 'filter_by'

I'm working on a computer grid dashboard and ran into the following error a few times: AttributeError: 'NoneType' object has no attribute 'filter_by' This happens after I change my model a little bit. The original model is: class Worker (UserMixin,…
1
vote
1 answer

Flask-Security RecursionError with Application Factory method

I am new to using Blueprint & Application-Factory. I am having issues trying to make Flask-Security work with Application factory method. I have gone through several posts and not able to find a solution that works. With my current setup I am…
mrzoogle
  • 111
  • 3
  • 14
1
vote
1 answer

How to get current_user from Flask Login to return a logged in user when using Pytest?

I'm testing a login view from a Flask application using Pytest. The login view is generated by Flask Security. When I log in the user either by posting data to the login route or by calling the login_user method, the current_user object is set to…
BryanB
  • 67
  • 1
  • 10
1
vote
1 answer

How to separate access in methods from BaseModelView class in Flask-Admin

I'm using Flask-Admin to manage my dashboard, there are few roles in my app, two of them are superuser and client. Now, I have User table build by Flask-SQLAlchemy, and now I want to manage the table by users role. Which means the superuser can edit…
Tri
  • 2,722
  • 5
  • 36
  • 65
1
vote
0 answers

Flask-Security Error - NameError: global name 'verify_and_update_password' is not defined

Please excuse my ignorance! I've followed the tutorial for flask-security with MongoEngine and keep getting the following error below when I try to signed in with a registered user account. NameError: global name 'verify_and_update_password' is not…
1
vote
0 answers

Jinja2/Flask makes my table tags disappear?

I'm trying to modify Flask-Security's _macros.html to nicely align everything. I replaced the p tags with tr and wrapped {{ field.label }} and {{ field(**kwargs)|safe }} both between td tags. For some reason those tags totally vanish from the output…
Avamander
  • 497
  • 16
  • 31
1
vote
0 answers

What benefits does Flask-Security provide when integrated into a project?

I am working on a Flask site I inherited from the last person to hold my position. It is a fairly large project with a lot of code, so any fundamental changes I want to make involve a lot of refactoring and rewriting code. With this being said, are…
lucky3
  • 53
  • 1
  • 9
1
vote
1 answer

Flask-Login logout_user does not change is_authenticated

I have a test for register/login/logout endpoints and it fails when I register a user, logout and try to login as registered user. For some reason in endpoint current_user.is_authenticated is still True after logout. Endpoints code: from flask…
Igor Nehoroshev
  • 308
  • 1
  • 3
  • 13