mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 17:01:29 +02:00
add User.can_use_fido
This commit is contained in:
parent
84c529c867
commit
18d62a81d1
@ -31,7 +31,7 @@ def fido():
|
||||
|
||||
user = User.get(user_id)
|
||||
|
||||
if not (user and (user.fido_enabled())):
|
||||
if not (user and user.fido_enabled()):
|
||||
flash("Only user with security key linked should go to this page", "warning")
|
||||
return redirect(url_for("auth.login"))
|
||||
|
||||
|
@ -140,8 +140,13 @@ class User(db.Model, ModelMixin, UserMixin):
|
||||
fido_pk = db.Column(db.String(), nullable=True, unique=True)
|
||||
fido_sign_count = db.Column(db.Integer(), nullable=True)
|
||||
|
||||
# whether user can use Fido
|
||||
can_use_fido = db.Column(
|
||||
db.Boolean, default=False, nullable=False, server_default="0"
|
||||
)
|
||||
|
||||
def fido_enabled(self) -> bool:
|
||||
if self.fido_uuid is not None:
|
||||
if self.can_use_fido and self.fido_uuid is not None:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user