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.
Questions tagged [flask-security]
319 questions
2
votes
3 answers
How to customize registration provided by Flask-security?
What am i supposed to do, if need to set up Role of user to, for example FooUser? Where i need to do this? In my own /create_account view or in context processor?
@app.route('/create_account')
def create_account():
…

cyberra
- 579
- 1
- 6
- 14
2
votes
1 answer
Flask-Security: Custom registration form doesn't validate properly
I have an app using Flask-Security where users need to enter additional information on registration.
Based on the Flask-Security documentation I have created an ExtendedRegisterForm:
class ExtendedRegisterForm(RegisterForm):
email =…

John W
- 199
- 2
- 11
2
votes
1 answer
Restricting one view on Flask-Admin?
I have a single file for a Flask application, views.py.
Inside views.py, I have the setup for Flask-Admin and the corresponding sqlalchemy database here:
db = SQLAlchemy(flaskapp)
def build_db():
import random
import…

asdfgthereisnocowlevel
- 23
- 1
- 5
2
votes
1 answer
SMTPServerDisconnected: please run connect() first
I'm exploring flask and attempting to setup a simple web app with secure registration and sign in. I'm using flask-security to do this. Unfortunately, when I navigate to the send confirmation page I'm getting the error: "smtpserverdisconnected:…

Jeffrey Rogers
- 307
- 1
- 2
- 8
2
votes
0 answers
Flask-Login: KeyError: 'security' when trying to call login_user
I have the following code that logs in a user on my Flask application:
@app.route('/login', methods = ['GET', 'POST'])
def login():
if request.method == 'GET':
return render_template('login.html')
db = get_db()
member =…

jix
- 51
- 1
2
votes
1 answer
Flask-Security Register Redirect
I have my login and register on the main page, index. When the user logs in or registers successfully, everything's gravy.
However, when there's an error, Flask-Security redirects the user to a different page, /login and /register respectively. I…

user592419
- 5,103
- 9
- 42
- 67
2
votes
2 answers
Setting a default role in flask-security
I am trying to set a default role when a user registers with my site, currently no roles are set when the user registers.
I have created the roles I need, so I just need to define it somehow. Not sure how though.
The code I have is pretty much copy…

mackwerk
- 1,689
- 4
- 21
- 44
2
votes
1 answer
Flask-Security can't initialize properly
After writing my own login/registration system, I found out about Flask-Security and decided to integrate it into my app. All of my authentication and recovery code is gone, but I can't figure out why I'm getting simple errors upon starting up my…

Blender
- 289,723
- 53
- 439
- 496
1
vote
2 answers
Flask 2.3 deprecated before_request decorerator
I am using flask security and sqlalchemy to store user credentials
but unfortunately flask 2.3 does not suppport security = Security(app, user_datastore)
any assistance would be appreicated.
I tried the following
user_datastore =…

Dejene T.
- 973
- 8
- 14
1
vote
1 answer
Python Flask 2.3.2 and Flask-Security 3.0.0 Roles Management
I am playing around with some Flask applications and try to get into Flask-Security. At this point I want to include the roles_required decorator and I am can not get away from this error:
AttributeError: 'Flask' object has no attribute…

Shark00n
- 85
- 1
- 10
1
vote
0 answers
bcrypt library which I am not calling directly. TypeError: Unicode-objects must be encoded before hashing
I've started getting a type error recently, and I've tried many things to fix but to no avail.
I believe the issue happened when I moved to the Heroku stack 22 from stack 18 (which if I recall correctly meant a Python update from 3.6 to 3.10).
I'm…

YouWereOnceABeginner
- 19
- 2
1
vote
0 answers
No module named 'flask_security' in my Flask app
The app.py:
import os
from flask import Flask, url_for, redirect, render_template, request, abort
from flask_sqlalchemy import SQLAlchemy
from flask_security import Security, SQLAlchemyUserDatastore, \
UserMixin, RoleMixin, login_required,…

sahil lone
- 63
- 4
1
vote
1 answer
jinja2.exceptions.UndefinedError: 'form' is undefined in Flask-security
I write a site on Flask, I connected flask-security, at first I changed the authorization template to the standard flask-security authorization template, I found a way to solve this problem, but now, as soon as I add a form to my template to work…

Dimaapp
- 123
- 1
- 1
- 7
1
vote
1 answer
with flask admin tab create user, use the security.database.create_user method to update or create
Im trying to se flask-admin and flask-security-too
and use the Views from flask-admin to administrate the users and its roles
the problem is that, the view from flask-admin is trying to update or create users with a standar db.commit() when the…

FalkZerd
- 56
- 6
1
vote
2 answers
Flask: How to access current user when creating forms?
I have found this question asked in various ways slightly different but the answers seemed old or not quite what I was looking for.
I have a functioning Flask application with Flask-Security and some WTF Forms. Users can login, fill up forms and…

Xosted
- 321
- 2
- 15