mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-29 05:25:30 -05:00
* feat(frontend): 💄 add recipe title * fix(frontend): 🐛 fixes #722 side-bar issue * feat(frontend): ✨ Add page titles to all pages * minor cleanup * refactor(backend): ♻️ rewrite scheduler to be more modulare and work * feat(frontend): ✨ start password reset functionality * refactor(backend): ♻️ refactor application settings to facilitate dependency injection * refactor(backend): 🔥 remove RECIPE_SETTINGS env variables in favor of group settings * formatting * refactor(backend): ♻️ align naming convention * feat(backend): ✨ password reset * test(backend): ✅ password reset * feat(frontend): ✨ self-service password reset * purge password schedule * update user creation for tests Co-authored-by: Hayden <hay-kot@pm.me>
63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
from mealie.core import root_logger
|
|
from mealie.core.config import get_app_settings
|
|
from mealie.core.security import hash_password
|
|
from mealie.db.data_access_layer.access_model_factory import Database
|
|
|
|
logger = root_logger.get_logger("init_users")
|
|
settings = get_app_settings()
|
|
|
|
|
|
def dev_users() -> list[dict]:
|
|
return [
|
|
{
|
|
"full_name": "Jason",
|
|
"username": "jason",
|
|
"email": "jason@email.com",
|
|
"password": hash_password(settings.DEFAULT_PASSWORD),
|
|
"group": settings.DEFAULT_GROUP,
|
|
"admin": False,
|
|
},
|
|
{
|
|
"full_name": "Bob",
|
|
"username": "bob",
|
|
"email": "bob@email.com",
|
|
"password": hash_password(settings.DEFAULT_PASSWORD),
|
|
"group": settings.DEFAULT_GROUP,
|
|
"admin": False,
|
|
},
|
|
{
|
|
"full_name": "Sarah",
|
|
"username": "sarah",
|
|
"email": "sarah@email.com",
|
|
"password": hash_password(settings.DEFAULT_PASSWORD),
|
|
"group": settings.DEFAULT_GROUP,
|
|
"admin": False,
|
|
},
|
|
{
|
|
"full_name": "Sammy",
|
|
"username": "sammy",
|
|
"email": "sammy@email.com",
|
|
"password": hash_password(settings.DEFAULT_PASSWORD),
|
|
"group": settings.DEFAULT_GROUP,
|
|
"admin": False,
|
|
},
|
|
]
|
|
|
|
|
|
def default_user_init(db: Database):
|
|
default_user = {
|
|
"full_name": "Change Me",
|
|
"username": "admin",
|
|
"email": settings.DEFAULT_EMAIL,
|
|
"password": hash_password(settings.DEFAULT_PASSWORD),
|
|
"group": settings.DEFAULT_GROUP,
|
|
"admin": True,
|
|
}
|
|
|
|
logger.info("Generating Default User")
|
|
db.users.create(default_user)
|
|
|
|
if not settings.PRODUCTION:
|
|
for user in dev_users():
|
|
db.users.create(user)
|