forked from Github-Mirrors/canaille
Merge branch '175-password-hashing-configuration' into 'main'
password-hashing-configuration Closes #175 See merge request yaal/canaille!210
This commit is contained in:
commit
c8f8e9fd06
3 changed files with 18 additions and 1 deletions
|
@ -4,6 +4,11 @@
|
|||
Added
|
||||
^^^^^
|
||||
- ``--version`` option to the CLI. :pr:`209`
|
||||
- :attr:`~canaille.backends.sql.configuration.SQLSettings.PASSWORD_SCHEMES` :issue:`175`
|
||||
|
||||
Changed
|
||||
^^^^^^^
|
||||
- fixed a bug on updating user's settings :issue:`206`
|
||||
|
||||
Changed
|
||||
^^^^^^^
|
||||
|
|
|
@ -15,3 +15,10 @@ class SQLSettings(BaseModel):
|
|||
|
||||
DATABASE_URI = "postgresql://user:password@localhost/database_name"
|
||||
"""
|
||||
|
||||
PASSWORD_SCHEMES: str = "pbkdf2_sha512"
|
||||
"""Password hashing scheme.
|
||||
|
||||
Defines password hashing scheme in SQL database.
|
||||
examples : "mssql2000", "ldap_salted_sha1", "pbkdf2_sha512"
|
||||
"""
|
||||
|
|
|
@ -74,7 +74,12 @@ class User(canaille.core.models.User, Base, SqlAlchemyModel):
|
|||
)
|
||||
user_name: Mapped[str] = mapped_column(String, unique=True, nullable=False)
|
||||
password: Mapped[str] = mapped_column(
|
||||
PasswordType(schemes=["pbkdf2_sha512"]), nullable=True
|
||||
PasswordType(
|
||||
onload=lambda **kwargs: dict(
|
||||
schemes=current_app.config["CANAILLE_SQL"]["PASSWORD_SCHEMES"], **kwargs
|
||||
),
|
||||
),
|
||||
nullable=True,
|
||||
)
|
||||
password_last_update: Mapped[datetime.datetime] = mapped_column(
|
||||
TZDateTime(timezone=True), nullable=True
|
||||
|
|
Loading…
Reference in a new issue