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
1 answer

struggling to test flask-dance / flask-security / flask-sqlalchemy / pytest

My application requires login to google for later use of google apis. I have flask-dance, flask-security, flask-sqlalchemy working to the point where I can do the log in and log out in my development system. What I've been struggling with is testing…
Lou K
  • 1,128
  • 2
  • 12
  • 31
1
vote
1 answer

Restricing access to route in Flask web framework

I have a page that is rendered only for logged in users that have a partcular role, something like this @app.route("/") @login_required @roles_required("admin") def admin_view(): return render_template("admin_page.html") and I want a button…
Elia Perantoni
  • 581
  • 1
  • 6
  • 19
1
vote
1 answer

login_required decorator not redirecting to correct endpoint

Using Flask-security extension, I was trying to protect some views, for example: from flask_security import login_required @auth.route('/signin', methods=['GET', 'POST']) def signin(): #... #... @auth.route('/change-password', methods=['GET',…
Iron Fist
  • 10,739
  • 2
  • 18
  • 34
1
vote
1 answer

Flask-Security login invalid password issue

I am implementing flask-security for simple registration and login, yet for some reason, I have not been able to understand or find, why after successful registration and successful login when I try to again login I get 'invalid password'. I am…
Francisco
  • 519
  • 1
  • 5
  • 15
1
vote
1 answer

Flask-Security token login without CSRF - Almost there but not quite

I have put in hours in this, and am sure I have a solution that will be useful to many here given the many unanswered questions - if you help me to perfect it I have a flask Web application that also serves as the backend for my android app. I…
Moses N. Njenga
  • 762
  • 1
  • 9
  • 19
1
vote
3 answers

Slow Flask response when using Flask-security

At my current job, I happened to be a part of a backend team, which is creating an API. The API should be then served to JavaScript application and needs to be quite fast (100 ms or so). However, it is not. After some profiling, we figured out that…
1
vote
0 answers

Flask-Security 'SQLAlchemy' object has no attribute 'add' when registering new user

I'm trying to implement the factorial pattern as described here and here. Currently, on my app.py I have this code: def create_app(mode): app = Flask(__name__) app.config.from_pyfile(mode) app.register_blueprint(app_blueprint) from…
user3142
  • 799
  • 3
  • 9
  • 14
1
vote
1 answer

Flask-Security @login_required decorator customize redirect

How would I override flask-security @login_required redirect URL? Currently when an user tried to access a page with @login_required decorater; they're prompted to login page by default, however I want to be able to redirect user to /register page…
Biplov
  • 1,136
  • 1
  • 20
  • 44
1
vote
1 answer

Flask Security: Customize Email Templates

How do you customize the email templates used in flask security without altering the source code? Everything else I have needed such as web templates and email subjects are configurable as defined in the configuration:…
1
vote
3 answers

flask_sqlalchemy object does not have attribute add when using flask_security

I am trying to add some roles/users with flask_security but run into this issue when I try to create users with the SQLAlchemySessionUserDatastore. So I first start by creating user_datastore like the guide db = SQLAlchemy(app) user_datastore =…
michael
  • 113
  • 9
1
vote
2 answers

Prevent automatic login in after Flask-Security password reset

When a user resets their password with Flask-Security, they are automatically logged in. I want to prevent this automatic login and require the user to log in manually. How can I call logout_user after the password is reset, or otherwise prevent the…
Jessi
  • 1,378
  • 6
  • 17
  • 37
1
vote
2 answers

Form undefined using Flask-Security

I am using Flask-Security with custom templates for my login forms. I have my form defined but for whatever reason the form isnt being passed to the template. Here is the form code class LoginForm(FlaskForm): email = TextField('Email Address',…
Kenton
  • 69
  • 1
  • 1
  • 8
1
vote
2 answers

Flask Secuirty Disable Password confirmation

Hi i am using python flask Flask-Security. I want to make users confirm their emails but not their passwords. It doesn't ask the user to enter in their password and another input to confirm passwords are matching. Instead it just asks the user for…
Holly Johnson
  • 509
  • 1
  • 13
  • 25
1
vote
0 answers

Set Secure Flag For Cookies In Flask-Security

I am doing server security testing and at every server security testing website it tells me that cookies are being created without the secure flag The message is specifically: The cookie is missing the Secure flag, make sure it does not store…
l3o
  • 123
  • 2
  • 6
1
vote
1 answer

Flask-Security init: unexpected keyword argument 'password'

Struggling to implement Flask-Security within my app. I'm getting an error creating default admin accounts. I followed example code very closely and am thus very confused as to the source of the error: TypeError: __init__() got an unexpected keyword…
dadiletta
  • 299
  • 3
  • 17