Debian Codegraph @

flask_security/models/fsqla_v2.py

raw
1 """
2 Copyright 2020 by J. Christopher Wagner (jwag). All rights reserved.
3 :license: MIT, see LICENSE for more details.
4
5
6 Complete models for all features when using Flask-SqlAlchemy
7
8 BE AWARE: Once any version of this is shipped no changes can be made - instead
9 a new version needs to be created.
10
11 This is Version 2:
12 - Add support for unified sign in.
13 - Make username unique (but not required).
14 """
15
16 # mypy: disable-error-code="assignment"
17 # pyright: reportAssignmentType = false, reportIncompatibleVariableOverride=false
18
19 from sqlalchemy import Column, String, Text
20
21
22 from .fsqla import FsModels
23 from .fsqla import FsUserMixin as FsUserMixinV1
24 from .fsqla import FsRoleMixin as FsRoleMixinV1
25
26 FsModels.fs_model_version = 2
27
28
29 class FsRoleMixin(FsRoleMixinV1):
30 pass
31
32
33 class FsUserMixin(FsUserMixinV1):
34 """User information"""
35
36 # Make username unique but not required.
37 username = Column(String(255), unique=True, nullable=True)
38
39 # unified sign in
40 us_totp_secrets = Column(Text, nullable=True)
41 us_phone_number = Column(String(128), nullable=True)